diff options
author | MarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com> | 2023-02-13 23:40:58 +0200 |
---|---|---|
committer | MarcoPolo-PasTonMolo <marcopolopastonmolo@protonmail.com> | 2023-02-13 23:40:58 +0200 |
commit | 6d266984a4729f09eda42027d6781d26eb198d25 (patch) | |
tree | 45b06a90450a21c31d0d28856b44ee3409070fd8 /src/tools/autocomplete.c | |
parent | 11055715845d7d7e5d3ef42982d04d1b65d57ac2 (diff) | |
download | profani-tty-6d266984a4729f09eda42027d6781d26eb198d25.tar.gz |
Fix quote and url autocompletion for MAM and history
After adding MAM quote and url autocompletion wouldn't pick up messages from MAM or history(from DB) or would have them in the wrong order. This commit fixes that. Fixes https://github.com/profanity-im/profanity/issues/1770
Diffstat (limited to 'src/tools/autocomplete.c')
-rw-r--r-- | src/tools/autocomplete.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 2f1acc1f..461c2b40 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -141,7 +141,7 @@ autocomplete_update(Autocomplete ac, char** items) } void -autocomplete_add_reverse(Autocomplete ac, const char* item) +autocomplete_add_unsorted(Autocomplete ac, const char* item, const gboolean is_reversed) { if (ac) { char* item_cpy; @@ -153,7 +153,12 @@ autocomplete_add_reverse(Autocomplete ac, const char* item) } item_cpy = strdup(item); - ac->items = g_list_prepend(ac->items, item_cpy); + + if (is_reversed) { + ac->items = g_list_prepend(ac->items, item_cpy); + } else { + ac->items = g_list_append(ac->items, item_cpy); + } } } |