summaryrefslogtreecommitdiff
path: root/src/fe-common/core/completion.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-10-14 14:32:53 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-10-14 14:32:53 +0000
commit4c882129c37e53e70fc08d9d0557039bb766a60d (patch)
tree0b92cfa5aabb53f23ca495ff385a2c62ab8be5d9 /src/fe-common/core/completion.c
parent98060c31852af87d488b11ad8322c7532375561a (diff)
downloadirssi-4c882129c37e53e70fc08d9d0557039bb766a60d.zip
/connect + /server server/chatnet completion by tommik.
Completion works now with commands that optionally could have subcommands, like /server l<tab> could return list (subcommand) or localhost (server). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@751 dbcabf3a-b0e7-0310-adc4-f8d773084564
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);