diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2007-02-25 18:05:53 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2007-02-25 18:05:53 +0000 |
commit | 1d54d999d5e54752adef549b23065c790306692a (patch) | |
tree | fe213bc7fafa562e32c934748a358015406c21e6 /src/fe-common | |
parent | d00a44ca0b80e923a0413c92a6dcae6d1ad2a654 (diff) | |
download | irssi-1d54d999d5e54752adef549b23065c790306692a.zip |
Add completion for /window goto.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4429 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/chat-completion.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/fe-common/core/chat-completion.c b/src/fe-common/core/chat-completion.c index dea73605..c9f9efe3 100644 --- a/src/fe-common/core/chat-completion.c +++ b/src/fe-common/core/chat-completion.c @@ -910,6 +910,33 @@ static void sig_complete_alias(GList **list, WINDOW_REC *window, } } +static void sig_complete_window(GList **list, WINDOW_REC *window, + const char *word, const char *linestart, + int *want_space) +{ + WINDOW_REC *win; + WI_ITEM_REC *item; + GSList *tmp; + int len; + + g_return_if_fail(list != NULL); + g_return_if_fail(word != NULL); + + len = strlen(word); + + for (tmp = windows; tmp != NULL; tmp = tmp->next) { + win = tmp->data; + item = win->active; + + if (win->name != NULL && g_strncasecmp(win->name, word, len) == 0) + *list = g_list_append(*list, g_strdup(win->name)); + if (item != NULL && g_strncasecmp(item->visible_name, word, len) == 0) + *list = g_list_append(*list, g_strdup(item->visible_name)); + } + + if (*list != NULL) signal_stop(); +} + static void sig_complete_channel(GList **list, WINDOW_REC *window, const char *word, const char *line, int *want_space) @@ -1136,6 +1163,7 @@ void chat_completion_init(void) signal_add("complete command away", (SIGNAL_FUNC) sig_complete_away); signal_add("complete command unalias", (SIGNAL_FUNC) sig_complete_unalias); signal_add("complete command alias", (SIGNAL_FUNC) sig_complete_alias); + signal_add("complete command window goto", (SIGNAL_FUNC) sig_complete_window); signal_add("complete command window item move", (SIGNAL_FUNC) sig_complete_channel); signal_add("complete command server add", (SIGNAL_FUNC) sig_complete_server); signal_add("complete command server remove", (SIGNAL_FUNC) sig_complete_server); @@ -1173,6 +1201,7 @@ void chat_completion_deinit(void) signal_remove("complete command away", (SIGNAL_FUNC) sig_complete_away); signal_remove("complete command unalias", (SIGNAL_FUNC) sig_complete_unalias); signal_remove("complete command alias", (SIGNAL_FUNC) sig_complete_alias); + signal_remove("complete command window goto", (SIGNAL_FUNC) sig_complete_window); signal_remove("complete command window item move", (SIGNAL_FUNC) sig_complete_channel); signal_remove("complete command server add", (SIGNAL_FUNC) sig_complete_server); signal_remove("complete command server remove", (SIGNAL_FUNC) sig_complete_server); |