From 1ab2cfc1b1196306beac0e169c1b9c399b2bcdfa Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 17 Apr 2002 15:30:26 +0000 Subject: [PATCH] /WINDOW ITEM GOTO now accepts a number too, to jump to nth window item. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2693 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/core/window-commands.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 8235b3ba..bbe495aa 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -427,7 +427,12 @@ static void cmd_window_server(const char *data) static void cmd_window_item(const char *data, void *server, WI_ITEM_REC *item) { - command_runsub("window item", data, server, item); + while (*data == ' ') data++; + + if (is_numeric(data, '\0')) + signal_emit("command window item goto", 3, data, server, item); + else + command_runsub("window item", data, server, item); } /* SYNTAX: WINDOW ITEM PREV */ @@ -442,12 +447,20 @@ static void cmd_window_item_next(void) window_item_next(active_win); } -/* SYNTAX: WINDOW ITEM GOTO */ +/* SYNTAX: WINDOW ITEM GOTO | */ static void cmd_window_item_goto(const char *data, SERVER_REC *server) { - WI_ITEM_REC *item; + WI_ITEM_REC *item; + GSList *tmp; + + if (is_numeric(data, '\0')) { + /* change to specified number */ + tmp = g_slist_nth(active_win->items, atoi(data)-1); + item = tmp == NULL ? NULL : tmp->data; + } else { + item = window_item_find_window(active_win, server, data); + } - item = window_item_find_window(active_win, server, data); if (item != NULL) window_item_set_active(active_win, item); }