about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/autocompleters.c19
-rw-r--r--src/plugins/callbacks.c2
2 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/autocompleters.c b/src/plugins/autocompleters.c
index 483af7ca..9acbf755 100644
--- a/src/plugins/autocompleters.c
+++ b/src/plugins/autocompleters.c
@@ -49,12 +49,21 @@ autocompleters_init(void)
 void
 autocompleters_add(const char *key, char **items)
 {
-    Autocomplete new_ac = autocomplete_new();
-    int i = 0;
-    for (i = 0; i < g_strv_length(items); i++) {
-        autocomplete_add(new_ac, items[i]);
+    if (g_hash_table_contains(autocompleters, key)) {
+        Autocomplete existing_ac = g_hash_table_lookup(autocompleters, key);
+
+        int i = 0;
+        for (i = 0; i < g_strv_length(items); i++) {
+            autocomplete_add(existing_ac, items[i]);
+        }
+    } else {
+        Autocomplete new_ac = autocomplete_new();
+        int i = 0;
+        for (i = 0; i < g_strv_length(items); i++) {
+            autocomplete_add(new_ac, items[i]);
+        }
+        g_hash_table_insert(autocompleters, strdup(key), new_ac);
     }
-    g_hash_table_insert(autocompleters, strdup(key), new_ac);
 }
 
 char *
diff --git a/src/plugins/callbacks.c b/src/plugins/callbacks.c
index 6f796259..92673395 100644
--- a/src/plugins/callbacks.c
+++ b/src/plugins/callbacks.c
@@ -108,7 +108,7 @@ plugins_run_command(const char * const input)
         PluginCommand *command = p_command->data;
         if (g_strcmp0(split[0], command->command_name) == 0) {
             gboolean result;
-            gchar **args = parse_args(input, command->min_args, command->max_args, &result);
+            gchar **args = parse_args_with_freetext(input, command->min_args, command->max_args, &result);
             if (result == FALSE) {
                 ui_invalid_command_usage(command->command_name, NULL);
                 g_strfreev(split);