diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-05-20 10:26:48 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-05-20 10:54:58 +0200 |
commit | aef74f90ece0d71a981312372e9a10df64e7035c (patch) | |
tree | c094d6eb5b5a38e0e5a55e8794f8473eea15d756 /src/tools/autocomplete.c | |
parent | ce32d874e0a4587010f5535fe7bff6b7438da560 (diff) | |
download | profani-tty-aef74f90ece0d71a981312372e9a10df64e7035c.tar.gz |
Only save max 20 urls
Diffstat (limited to 'src/tools/autocomplete.c')
-rw-r--r-- | src/tools/autocomplete.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c index 5e9f14f1..6c960ba2 100644 --- a/src/tools/autocomplete.c +++ b/src/tools/autocomplete.c @@ -385,6 +385,18 @@ autocomplete_param_no_with_func(const char *const input, char *command, int arg_ return NULL; } +/* remove the first message if we have more than max */ +void +autocomplete_remove_older_than_max(Autocomplete ac, int maxsize) +{ + if (autocomplete_length(ac) > maxsize) { + GList *first = g_list_nth(ac->items, 0); + if (first) { + ac->items = g_list_delete_link(ac->items, first); + } + } +} + static gchar* _search_next(Autocomplete ac, GList *curr, gboolean quote) { |