mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
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
This commit is contained in:
parent
d51a03ed01
commit
3a1ef5d9eb
@ -279,6 +279,33 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window)
|
|||||||
return max_win;
|
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> */
|
/* SYNTAX: WINDOW GOTO active|<number>|<name> */
|
||||||
static void cmd_window_goto(const char *data)
|
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)
|
if (g_strcasecmp(target, "active") == 0)
|
||||||
window = window_highest_activity(active_win);
|
window = window_highest_activity(active_win);
|
||||||
else
|
else {
|
||||||
window = window_find_item(active_win->active_server, target);
|
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)
|
if (window != NULL)
|
||||||
window_set_active(window);
|
window_set_active(window);
|
||||||
|
Loading…
Reference in New Issue
Block a user