From ff86916dc38033d6b459ece72028e84eeab3938c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 10 Jun 2000 19:16:25 +0000 Subject: [PATCH] Ctrl-X changes IRC server in stats/msgs/empty windows. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@312 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/gui-readline.c | 25 +++++++++++++++++++++++-- src/fe-text/statusbar-items.c | 3 ++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index b7b60038..10d54c86 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -367,12 +367,33 @@ static void sig_window_goto_active(void) static void sig_prev_window_item(void) { - signal_emit("command window item prev", 3, "", active_win->active_server, active_win->active); + SERVER_REC *server; + GSList *pos; + + if (active_win->items != NULL) + signal_emit("command window item prev", 3, "", active_win->active_server, active_win->active); + else if (active_win->active_server != NULL) { + /* change server */ + pos = g_slist_find(servers, active_win->active_server); + server = pos->next != NULL ? pos->next->data : servers->data; + signal_emit("command window server", 3, server->tag, active_win->active_server, active_win->active); + } } static void sig_next_window_item(void) { - signal_emit("command window item next", 3, "", active_win->active_server, active_win->active); + SERVER_REC *server; + int index; + + if (active_win->items != NULL) + signal_emit("command window item next", 3, "", active_win->active_server, active_win->active); + else if (active_win->active_server != NULL) { + /* change server */ + index = g_slist_index(servers, active_win->active_server); + server = index > 0 ? g_slist_nth(servers, index-1)->data : + g_slist_last(servers)->data; + signal_emit("command window server", 3, server->tag, active_win->active_server, active_win->active); + } } static void sig_addchar(const char *data) diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index fde8bff0..d2290520 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -225,7 +225,7 @@ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos) mode = NULL; mode_size = 0; - size_needed = 3 + strlen(winnum) + (server == NULL ? 0 : strlen(server->tag)); + size_needed = 3 + strlen(winnum) + (server == NULL ? 0 : (17+strlen(server->tag))); } else { @@ -264,6 +264,7 @@ static void statusbar_channel(SBAR_ITEM_REC *item, int ypos) { /* server tag */ set_color((1 << 4)+7); addstr(server->tag); + addstr(" (change with ^X)"); } else if (channame[0] != '\0') {