summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2007-08-04 16:38:01 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-08-04 16:38:01 +0000
commit39d42bdad42e2ce939552918c42bf6d3247b766c (patch)
tree2c2fed9e709e5d1dc60da998fd9cc7538909a560 /src/fe-common
parent402fa7ad9478eeafb09f29b184d8f46f6c6c70da (diff)
downloadirssi-39d42bdad42e2ce939552918c42bf6d3247b766c.zip
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
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/window-commands.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c
index 7c4a4ee2..c67fa1cc 100644
--- a/src/fe-common/core/window-commands.c
+++ b/src/fe-common/core/window-commands.c
@@ -279,6 +279,17 @@ static WINDOW_REC *window_highest_activity(WINDOW_REC *window)
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)
{
WINDOW_REC *rec, *win;
@@ -297,9 +308,10 @@ static WINDOW_REC *window_find_item_cycle(SERVER_REC *server, const char *name)
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;
- break;
+ if (server != NULL) break;
}
}