summaryrefslogtreecommitdiff
path: root/src/fe-common/core/completion.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-07-09 00:03:46 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-07-09 00:03:46 +0000
commit8bea491a572a4038ea23d38fb6b9691bbd3a44a3 (patch)
treeb6cc9fee93ddb482573303244d29180a02afd89a /src/fe-common/core/completion.c
parentabb46a03131575d3d3c980b9813941671620c67b (diff)
downloadirssi-8bea491a572a4038ea23d38fb6b9691bbd3a44a3.zip
Moved is_base_command() from command completion to command_have_sub()
in core/commands. /HELP <command with subcommands> works now right. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@437 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/completion.c')
-rw-r--r--src/fe-common/core/completion.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index 4a62d4f6..aa1859c7 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -265,25 +265,6 @@ GList *filename_complete(const char *path)
return list;
}
-static int is_base_command(const char *command)
-{
- GSList *tmp;
- int len;
-
- g_return_val_if_fail(command != NULL, FALSE);
-
- /* find "command "s */
- len = strlen(command);
- for (tmp = commands; tmp != NULL; tmp = tmp->next) {
- COMMAND_REC *rec = tmp->data;
-
- if (g_strncasecmp(rec->cmd, command, len) == 0 && rec->cmd[len] == ' ')
- return TRUE;
- }
-
- return FALSE;
-}
-
static GList *completion_get_settings(const char *key)
{
GList *complist;
@@ -509,7 +490,7 @@ static void sig_complete_word(GList **list, WINDOW_REC *window,
line = linestart[1] == *cmdchars ? g_strdup(linestart+2) :
expand_aliases(linestart+1);
- if (is_base_command(line)) {
+ if (command_have_sub(line)) {
/* complete subcommand */
cmd = g_strconcat(line, " ", word, NULL);
*list = completion_get_subcommands(cmd);
@@ -600,7 +581,7 @@ static void sig_complete_command(GList **list, WINDOW_REC *window,
if (*line == '\0') {
/* complete base command */
*list = completion_get_commands(word, '\0');
- } else if (is_base_command(line)) {
+ } else if (command_have_sub(line)) {
/* complete subcommand */
cmd = g_strconcat(line, " ", word, NULL);
*list = completion_get_subcommands(cmd);