summaryrefslogtreecommitdiff
path: root/src/fe-common/core/completion.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-common/core/completion.c')
-rw-r--r--src/fe-common/core/completion.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index a7e80b74..1e4e49db 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -495,17 +495,6 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
line = linestart[1] == *cmdchars ? g_strdup(linestart+2) :
expand_aliases(linestart+1);
- if (command_have_sub(line)) {
- /* complete subcommand */
- cmd = g_strconcat(line, " ", word, NULL);
- *list = completion_get_subcommands(cmd);
- g_free(cmd);
-
- if (*list != NULL) signal_stop();
- g_free(line);
- return;
- }
-
cmd = line_get_command(line, &args, FALSE);
if (cmd == NULL) {
g_free(line);
@@ -514,7 +503,7 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
/* we're completing -option? */
if (*word == '-') {
- *list = completion_get_options(cmd, word+1);
+ *list = completion_get_options(cmd, word+1);
g_free(cmd);
g_free(line);
return;
@@ -524,6 +513,15 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
signal = g_strconcat("complete command ", cmd, NULL);
signal_emit(signal, 5, list, window, word, args, want_space);
+ if (command_have_sub(line)) {
+ /* complete subcommand */
+ g_free(cmd);
+ cmd = g_strconcat(line, " ", word, NULL);
+ *list = g_list_concat(completion_get_subcommands(cmd), *list);
+
+ if (*list != NULL) signal_stop();
+ }
+
g_free(signal);
g_free(cmd);