Toggle the channel tree with Ctrl+Y
This commit is contained in:
parent
9b152e32cc
commit
fd14e03f37
2 changed files with 14 additions and 1 deletions
|
|
@ -175,6 +175,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) |
|
| `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+Left` / `Ctrl+Right` | move to the previous / next word in the input line |
|
||||||
| `Ctrl+PgUp` / `Ctrl+PgDn` | scroll the channel tree by one row |
|
| `Ctrl+PgUp` / `Ctrl+PgDn` | scroll the channel tree by one row |
|
||||||
|
| `Ctrl+Y` | hide or show the channel tree |
|
||||||
| `Ctrl+N` or `Ctrl+Down` / `Ctrl+P` or `Ctrl+Up` | next / previous visible window (tree order, wraps around) |
|
| `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) |
|
| Enter | with empty input, fold or unfold a server, or toggle a chat’s sticky status (`*` after its name) |
|
||||||
| `Ctrl+O` | toggle hiding inactive channels and private chats with no unread messages. Active and sticky chats stay visible when their server is unfolded |
|
| `Ctrl+O` | toggle hiding inactive channels and private chats with no unread messages. Active and sticky chats stay visible when their server is unfolded |
|
||||||
|
|
|
||||||
14
irc9.c
14
irc9.c
|
|
@ -202,6 +202,7 @@ static int terminal_active;
|
||||||
static int terminal_color;
|
static int terminal_color;
|
||||||
static int colored_nicks;
|
static int colored_nicks;
|
||||||
static int copy_view;
|
static int copy_view;
|
||||||
|
static int tree_hidden;
|
||||||
static long accent_color = -1;
|
static long accent_color = -1;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
@ -2483,6 +2484,7 @@ static void do_command(Window *window, char *line)
|
||||||
appendf(t, "keys: ctrl-n / ctrl-p switch windows, pgup/pgdn scroll, ctrl-l clear screen");
|
appendf(t, "keys: ctrl-n / ctrl-p switch windows, pgup/pgdn scroll, ctrl-l clear screen");
|
||||||
appendf(t, " ctrl-up / ctrl-down scroll the channel tree");
|
appendf(t, " ctrl-up / ctrl-down scroll the channel tree");
|
||||||
appendf(t, " ctrl-s save scrollback, ctrl-t toggle copy view");
|
appendf(t, " ctrl-s save scrollback, ctrl-t toggle copy view");
|
||||||
|
appendf(t, " ctrl-y hide or show the channel tree");
|
||||||
} else {
|
} else {
|
||||||
if (window) appendf(window, "* unknown command: /%s", cmd);
|
if (window) appendf(window, "* unknown command: /%s", cmd);
|
||||||
}
|
}
|
||||||
|
|
@ -2702,6 +2704,12 @@ static void handle_key(int c)
|
||||||
dirty = 1;
|
dirty = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (c == 0x19) { /* ctrl-y */
|
||||||
|
tree_hidden = !tree_hidden;
|
||||||
|
layout();
|
||||||
|
dirty = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (c == 0x0c) { /* ctrl-l */
|
if (c == 0x0c) { /* ctrl-l */
|
||||||
if (curwin) { curwin->scroll = -(mainh - layout_topic(0)); dirty = 1; }
|
if (curwin) { curwin->scroll = -(mainh - layout_topic(0)); dirty = 1; }
|
||||||
return;
|
return;
|
||||||
|
|
@ -2764,7 +2772,7 @@ static void handle_key(int c)
|
||||||
static void layout(void)
|
static void layout(void)
|
||||||
{
|
{
|
||||||
treew = cols >= 60 ? TREEW : (cols >= 30 ? 16 : 8);
|
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;
|
else if (treew > cols / 2) treew = cols / 2;
|
||||||
chat_top = lines >= 7 ? 2 : 1;
|
chat_top = lines >= 7 ? 2 : 1;
|
||||||
mainh = lines >= 5 ? lines - 3 - chat_top : 0;
|
mainh = lines >= 5 ? lines - 3 - chat_top : 0;
|
||||||
|
|
@ -3293,6 +3301,10 @@ static void terminal_start(void)
|
||||||
struct termios mode = saved_terminal;
|
struct termios mode = saved_terminal;
|
||||||
mode.c_lflag &= ~(ICANON | ECHO | IEXTEN);
|
mode.c_lflag &= ~(ICANON | ECHO | IEXTEN);
|
||||||
mode.c_iflag &= ~(ICRNL | INLCR | IGNCR | ISTRIP | IXON | IXOFF);
|
mode.c_iflag &= ~(ICRNL | INLCR | IGNCR | ISTRIP | IXON | IXOFF);
|
||||||
|
#ifdef VDSUSP
|
||||||
|
/* Allow Ctrl+Y to reach the key handler on terminals with delayed suspend. */
|
||||||
|
mode.c_cc[VDSUSP] = _POSIX_VDISABLE;
|
||||||
|
#endif
|
||||||
mode.c_cc[VMIN] = 0;
|
mode.c_cc[VMIN] = 0;
|
||||||
mode.c_cc[VTIME] = 0;
|
mode.c_cc[VTIME] = 0;
|
||||||
if (tcsetattr(STDIN_FILENO, TCSANOW, &mode) < 0)
|
if (tcsetattr(STDIN_FILENO, TCSANOW, &mode) < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue