diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2007-06-10 18:00:26 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2007-06-10 18:00:26 +0000 |
commit | 3a1ef5d9ebbb16104ef811b67b6f8768871b37f9 (patch) | |
tree | 297e821a23290866e0fe2f4e673cd7dfd3d7ec78 /src/fe-common | |
parent | d51a03ed01d0714ac1cd6a563e92871d8caf0665 (diff) | |
download | irssi-3a1ef5d9ebbb16104ef811b67b6f8768871b37f9.zip |
Make /window goto start searching at the window after the active one and stop
at the one before, bug #332.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4550 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/window-commands.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 8ffeb046..7c4a4ee2 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -279,6 +279,33 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window) return max_win; } +static WINDOW_REC *window_find_item_cycle(SERVER_REC *server, const char *name) +{ + WINDOW_REC *rec, *win; + GSList *tmp; + + win = NULL; + + tmp = g_slist_find(windows, active_win); + tmp = tmp->next; + for (;; tmp = tmp->next) { + if (tmp == NULL) + tmp = windows; + + if (tmp->data == active_win) + break; + + rec = tmp->data; + + if (window_item_find_window(rec, server, name) != NULL) { + win = rec; + break; + } + } + + return win; +} + /* SYNTAX: WINDOW GOTO active|<number>|<name> */ static void cmd_window_goto(const char *data) { @@ -298,8 +325,13 @@ static void cmd_window_goto(const char *data) if (g_strcasecmp(target, "active") == 0) window = window_highest_activity(active_win); - else - window = window_find_item(active_win->active_server, target); + else { + window = window_find_name(target); + if (window == NULL && active_win->active_server != NULL) + window = window_find_item_cycle(active_win->active_server, target); + if (window == NULL) + window = window_find_item_cycle(NULL, target); + } if (window != NULL) window_set_active(window); |