From 79efe56d64fb639f96f3ed3e421b9bb7ee37957e Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 9 May 2023 20:10:55 +0200 Subject: [PATCH] Add autocompletion for /executable parameters We autocompleted `/executable` to `avatar`, `vcard_photo`, `editor` etc. But didn't autocomplete the next parameter. Namely `set` and `default`. --- src/command/cmd_ac.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index 17d08888..d93633c3 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -277,6 +277,7 @@ static Autocomplete correction_ac; static Autocomplete avatar_ac; static Autocomplete url_ac; static Autocomplete executable_ac; +static Autocomplete executable_param_ac; static Autocomplete intype_ac; static Autocomplete mood_ac; static Autocomplete mood_type_ac; @@ -1117,6 +1118,10 @@ cmd_ac_init(void) autocomplete_add(executable_ac, "editor"); autocomplete_add(executable_ac, "vcard_photo"); + executable_param_ac = autocomplete_new(); + autocomplete_add(executable_param_ac, "set"); + autocomplete_add(executable_param_ac, "default"); + intype_ac = autocomplete_new(); autocomplete_add(intype_ac, "console"); autocomplete_add(intype_ac, "titlebar"); @@ -1702,6 +1707,7 @@ cmd_ac_reset(ProfWin* window) autocomplete_reset(avatar_ac); autocomplete_reset(url_ac); autocomplete_reset(executable_ac); + autocomplete_reset(executable_param_ac); autocomplete_reset(intype_ac); autocomplete_reset(mood_ac); autocomplete_reset(mood_type_ac); @@ -1889,6 +1895,7 @@ cmd_ac_uninit(void) autocomplete_free(avatar_ac); autocomplete_free(url_ac); autocomplete_free(executable_ac); + autocomplete_free(executable_param_ac); autocomplete_free(intype_ac); autocomplete_free(adhoc_cmd_ac); autocomplete_free(lastactivity_ac); @@ -4382,6 +4389,31 @@ _executable_autocomplete(ProfWin* window, const char* const input, gboolean prev { char* result = NULL; + result = autocomplete_param_with_ac(input, "/executable avatar", executable_param_ac, TRUE, previous); + if (result) { + return result; + } + + result = autocomplete_param_with_ac(input, "/executable urlopen", executable_param_ac, TRUE, previous); + if (result) { + return result; + } + + result = autocomplete_param_with_ac(input, "/executable urlsave", executable_param_ac, TRUE, previous); + if (result) { + return result; + } + + result = autocomplete_param_with_ac(input, "/executable vcard_photo", executable_param_ac, TRUE, previous); + if (result) { + return result; + } + + result = autocomplete_param_with_ac(input, "/executable editor", executable_param_ac, TRUE, previous); + if (result) { + return result; + } + result = autocomplete_param_with_ac(input, "/executable", executable_ac, TRUE, previous); return result;