1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Don't add same /command more than once to completion list.

Completion didn't work right when completing subcommands's subcommand.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@359 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-17 13:04:19 +00:00 committed by cras
parent ea00d4c948
commit 8c60237fbe

View File

@ -204,6 +204,7 @@ static GList *completion_get_commands(const char *cmd, char cmdchar)
{
GList *complist;
GSList *tmp;
char *word;
int len;
len = strlen(cmd);
@ -214,8 +215,13 @@ static GList *completion_get_commands(const char *cmd, char cmdchar)
if (strchr(rec->cmd, ' ') != NULL)
continue;
if (g_strncasecmp(rec->cmd, cmd, len) == 0)
complist = g_list_append(complist, g_strdup_printf("%c%s", cmdchar, rec->cmd));
if (g_strncasecmp(rec->cmd, cmd, len) == 0) {
word = g_strdup_printf("%c%s", cmdchar, rec->cmd);
if (glist_find_icase_string(complist, word) == NULL)
complist = g_list_append(complist, word);
else
g_free(word);
}
}
return complist;
}
@ -228,7 +234,7 @@ static GList *completion_get_subcommands(const char *cmd)
int len, skip;
/* get the number of chars to skip at the start of command. */
spacepos = strchr(cmd, ' ');
spacepos = strrchr(cmd, ' ');
skip = spacepos == NULL ? 0 :
((int) (spacepos-cmd) + 1);