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

Fix /window goto to reach all the items with the same name when there

are more than two.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4595 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-08-04 16:38:01 +00:00 committed by exg
parent 402fa7ad94
commit 39d42bdad4

View File

@ -279,6 +279,17 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window)
return max_win; return max_win;
} }
static inline int is_nearer(int r1, int r2)
{
int a = r2 < active_win->refnum;
int b = r1 < r2;
if (r1 > active_win->refnum)
return a || b;
else
return a && b;
}
static WINDOW_REC *window_find_item_cycle(SERVER_REC *server, const char *name) static WINDOW_REC *window_find_item_cycle(SERVER_REC *server, const char *name)
{ {
WINDOW_REC *rec, *win; WINDOW_REC *rec, *win;
@ -297,9 +308,10 @@ static WINDOW_REC *window_find_item_cycle(SERVER_REC *server, const char *name)
rec = tmp->data; rec = tmp->data;
if (window_item_find_window(rec, server, name) != NULL) { if (window_item_find_window(rec, server, name) != NULL &&
(win == NULL || is_nearer(rec->refnum, win->refnum))) {
win = rec; win = rec;
break; if (server != NULL) break;
} }
} }