Merge branch 'fix/correct-autocompletion'
All checks were successful
CI / Check spelling (push) Successful in 18s
CI / Check coding style (push) Successful in 31s
CI / Linux (debian) (push) Successful in 10m43s
CI / Linux (arch) (push) Successful in 13m6s
CI / Linux (ubuntu) (push) Successful in 13m13s

This commit is contained in:
2025-09-02 14:20:23 +02:00
2 changed files with 16 additions and 7 deletions

View File

@@ -424,9 +424,11 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, const char
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message); win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message);
} }
// save last id and message for LMC in case if it's not LMC message // Save last id and message for LMC
if (id && !replace_id) { // Note: if the same message is to be corrected several times, the id of the original message is used in each case
_chatwin_set_last_message(chatwin, id, display_message); // https://xmpp.org/extensions/xep-0308.html#rules
if (id) {
_chatwin_set_last_message(chatwin, replace_id ?: id, display_message);
} }
} }
@@ -625,9 +627,13 @@ chatwin_db_history(ProfChatWin* chatwin, const gchar* start_time, const gchar* e
static void static void
_chatwin_set_last_message(ProfChatWin* chatwin, const char* const id, const char* const message) _chatwin_set_last_message(ProfChatWin* chatwin, const char* const id, const char* const message)
{ {
free(chatwin->last_message); if (message && chatwin->last_message != message) {
chatwin->last_message = strdup(message); free(chatwin->last_message);
chatwin->last_message = strdup(message);
}
free(chatwin->last_msg_id); if (id && chatwin->last_msg_id != id) {
chatwin->last_msg_id = strdup(id); free(chatwin->last_msg_id);
chatwin->last_msg_id = strdup(id);
}
} }

View File

@@ -27,6 +27,9 @@ message_send(void **state)
assert_true(prof_output_regex("me: .+Hi there")); assert_true(prof_output_regex("me: .+Hi there"));
} }
// TODO: `/message correct` XEP-0308 compliance (whether each correction links to the original message ID)
// https://xmpp.org/extensions/xep-0308.html#rules
void void
message_receive_console(void **state) message_receive_console(void **state)
{ {