summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-04-17 15:30:26 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-04-17 15:30:26 +0000
commit1ab2cfc1b1196306beac0e169c1b9c399b2bcdfa (patch)
tree4630a0d3787b8aac013f8ef4b09c9d1edd9955a1 /src
parent9b74ba4e5cbebf47232bfa46295f29f90cf5ecf4 (diff)
downloadirssi-1ab2cfc1b1196306beac0e169c1b9c399b2bcdfa.zip
/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
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/core/window-commands.c21
1 files 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 <name> */
+/* SYNTAX: WINDOW ITEM GOTO <number>|<name> */
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);
}