mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
xep-0308: Add autocompletion of last message for /correct
This commit is contained in:
parent
4ec005e4c3
commit
bc571a387d
@ -3742,8 +3742,33 @@ _correction_autocomplete(ProfWin *window, const char *const input, gboolean prev
|
||||
static char*
|
||||
_correct_autocomplete(ProfWin *window, const char *const input, gboolean previous)
|
||||
{
|
||||
char *result = NULL;
|
||||
char *last_message = NULL;
|
||||
switch(window->type) {
|
||||
case WIN_CHAT:
|
||||
{
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||
last_message = chatwin->last_message;
|
||||
break;
|
||||
}
|
||||
case WIN_MUC:
|
||||
{
|
||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||
last_message = mucwin->last_message;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//TODO: get last message
|
||||
return result;
|
||||
if (last_message == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GString *result_str = g_string_new("/correct ");
|
||||
g_string_append(result_str, last_message);
|
||||
char *result = result_str->str;
|
||||
g_string_free(result_str, FALSE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user