diff options
author | Michael Vetter <jubalh@iodoru.org> | 2023-05-09 20:10:55 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2023-05-10 09:34:52 +0200 |
commit | 79efe56d64fb639f96f3ed3e421b9bb7ee37957e (patch) | |
tree | d6da252bc3088c1b36c43fa552838d2e4ecad856 /src/command | |
parent | 46c90bc68138ca0268ef2562e4f8c9917daf257f (diff) | |
download | profani-tty-79efe56d64fb639f96f3ed3e421b9bb7ee37957e.tar.gz |
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`.
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_ac.c | 32 |
1 files changed, 32 insertions, 0 deletions
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; |