Toggle the channel tree with Ctrl+Y

This commit is contained in:
Johannes Findeisen 2026-12-03 01:11:14 +01:00
commit b1f78e18f0
2 changed files with 14 additions and 1 deletions

14
irc9.c
View file

@ -198,6 +198,7 @@ static int tree_offset;
static int hide_read_windows;
static int treew = TREEW, mainh = 1, chat_top = 1;
static struct termios saved_terminal;
static int tree_hidden;
static int terminal_active;
static int terminal_color;
static int colored_nicks;
@ -2463,6 +2464,7 @@ static void do_command(Window *window, char *line)
window_clear(window);
} else if (strcasecmp(cmd, "reconnect") == 0) {
if (!window) return;
appendf(t, " ctrl-y hide or show the channel tree");
Server *s = window->srv;
appendf(serverwin(s), "* reconnecting to %s:%d", s->host, s->port);
disconnect_server(s);
@ -2682,6 +2684,12 @@ static void handle_key(int c)
if (c == 0x13 && curwin) { /* ctrl-s */
saving = 1;
save_path[0] = 0;
if (c == 0x19) { /* ctrl-y */
tree_hidden = !tree_hidden;
layout();
dirty = 1;
return;
}
save_len = save_pos = 0;
dirty = 1;
return;
@ -2764,7 +2772,7 @@ static void handle_key(int c)
static void layout(void)
{
treew = cols >= 60 ? TREEW : (cols >= 30 ? 16 : 8);
if (copy_view || lines < 6) treew = 0;
if (copy_view || tree_hidden || lines < 6) treew = 0;
else if (treew > cols / 2) treew = cols / 2;
chat_top = lines >= 7 ? 2 : 1;
mainh = lines >= 5 ? lines - 3 - chat_top : 0;
@ -3271,6 +3279,10 @@ static void redraw(void)
input_dirty = 0;
}
#ifdef VDSUSP
/* Allow Ctrl+Y to reach the key handler on terminals with delayed suspend. */
mode.c_cc[VDSUSP] = _POSIX_VDISABLE;
#endif
static void check_resize(void)
{
struct winsize size;