Incorrect Autocompletion in /correct Command
#24
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The
/correctcommand's autocompletion feature incorrectly suggests the original message content (e.g.,Hello) instead of the corrected message content (e.g.,Hi) when using Last Message Correction (LMC). This occurs becausechatwin_outgoing_msgonly calls_chatwin_set_last_messagefor original messages (whenreplace_idisNULL), preventing the message content from being updated for autocompletion.Steps to Reproduce
Hello./correct Hito replace it with a new message./correctand press<tab>for autocompletion./correct Hello(original message) instead of/correct Hi(corrected message).Expected Behavior
Autocompletion for
/correctshould suggest the corrected message content (e.g.,/correct Hi).Root Cause
In
chatwin_outgoing_msg,_chatwin_set_last_messageis only called whenreplace_idisNULL(original messages). This prevents the corrected message content from being stored for autocompletion, causing/correctto suggest the original message content.Proposed Fix
Modify
chatwin_outgoing_msgto call_chatwin_set_last_messagefor both original and corrected messages, usingreplace_id(if present) oridto preserve the original message ID (as per XEP-0308), while updating the message content for autocompletion.Add unit tests to verify:
Related Issues
https://github.com/profanity-im/profanity/issues/1899#issuecomment-1769942338