about summary refs log tree commit diff stats
path: root/src/command/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-09-17 23:03:03 +0100
committerJames Booth <boothj5@gmail.com>2014-09-17 23:03:03 +0100
commitfa7b6f30000d536f45125f677a0fc820ad758e11 (patch)
tree642c8edda453daf81157b8abf4b9cb70eda0d06e /src/command/command.c
parente42a0847a2d59c5eba93e36ce7c6d1b7275dd621 (diff)
downloadprofani-tty-fa7b6f30000d536f45125f677a0fc820ad758e11.tar.gz
Added autocompletion for form list-multi values
Diffstat (limited to 'src/command/command.c')
-rw-r--r--src/command/command.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 4c245c87..68df1cc7 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -2128,7 +2128,7 @@ _form_autocomplete(char *input, int *size)
                 form_field_type_t field_type = form_get_field_type(form, tag);
 
                 // handle boolean (set)
-                if ((g_strcmp0(args[0], "set") == 0)  && field_type == FIELD_BOOLEAN) {
+                if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_BOOLEAN) {
                     found = autocomplete_param_with_func(input, size, beginning->str,
                         prefs_autocomplete_boolean_choice);
                     g_string_free(beginning, TRUE);
@@ -2138,7 +2138,7 @@ _form_autocomplete(char *input, int *size)
                 }
 
                 // handle list-single (set)
-                if ((g_strcmp0(args[0], "set") == 0)  && field_type == FIELD_LIST_SINGLE) {
+                if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_LIST_SINGLE) {
                     Autocomplete ac = form_get_value_ac(form, tag);
                     found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE);
                     g_string_free(beginning, TRUE);
@@ -2148,6 +2148,15 @@ _form_autocomplete(char *input, int *size)
                 }
 
                 // handle list-multi (add, remove)
+                if (((g_strcmp0(args[0], "set") == 0) || (g_strcmp0(args[0], "remove") == 0))
+                        && field_type == FIELD_LIST_MULTI) {
+                    Autocomplete ac = form_get_value_ac(form, tag);
+                    found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE);
+                    g_string_free(beginning, TRUE);
+                    if (found != NULL) {
+                        return found;
+                    }
+                }
 
                 // handle text-multi (remove)