diff --git a/README.md b/README.md index ebedab2..a22728d 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ MODE, TOPIC, and INVITE events are shown in the relevant window. | --- | --- | | `Tab` | complete a `/` command or a nick; press again to cycle matches (recently completed nicks come first) | | `Ctrl+Left` / `Ctrl+Right` | move to the previous / next word in the input line | +| `Ctrl+Y` | hide or show the channel tree | | `Ctrl+PgUp` / `Ctrl+PgDn` | scroll the channel tree by one row | | `Ctrl+N` or `Ctrl+Down` / `Ctrl+P` or `Ctrl+Up` | next / previous visible window (tree order, wraps around) | | Enter | with empty input, fold or unfold a server, or toggle a chat’s sticky status (`*` after its name) | diff --git a/irc9.c b/irc9.c index 3a599cb..6ed605c 100644 --- a/irc9.c +++ b/irc9.c @@ -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;