summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-05-16 15:46:02 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-05-16 15:46:02 +0000
commit92385533c889a9f2e4b5fe846ef83ceb9b849019 (patch)
tree3bb66a612486f88f0bf8ae3d74538b02c7bdb82b /usr.bin
parentdfbc90edaae2adf0ea3cb886f8ee4b66a44e37ef (diff)
Add M-+ and M-- to expand and collapse all items in tree mode.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/mode-tree.c14
-rw-r--r--usr.bin/tmux/tmux.16
2 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c
index 08327b52866..36e447cf00d 100644
--- a/usr.bin/tmux/mode-tree.c
+++ b/usr.bin/tmux/mode-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-tree.c,v 1.43 2020/05/16 15:34:08 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.44 2020/05/16 15:46:01 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -887,7 +887,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
struct mouse_event *m, u_int *xp, u_int *yp)
{
struct mode_tree_line *line;
- struct mode_tree_item *current, *parent;
+ struct mode_tree_item *current, *parent, *mti;
u_int i, x, y;
int choice;
key_code tmp;
@@ -1058,6 +1058,16 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
mode_tree_build(mtd);
}
break;
+ case '-'|KEYC_ESCAPE:
+ TAILQ_FOREACH(mti, &mtd->children, entry)
+ mti->expanded = 0;
+ mode_tree_build(mtd);
+ break;
+ case '+'|KEYC_ESCAPE:
+ TAILQ_FOREACH(mti, &mtd->children, entry)
+ mti->expanded = 1;
+ mode_tree_build(mtd);
+ break;
case '?':
case '/':
case '\023': /* C-s */
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 3c4bf168997..f9825caa29e 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.762 2020/05/16 15:45:29 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.763 2020/05/16 15:46:01 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -1903,6 +1903,10 @@ The following keys may be used in tree mode:
.It Li "Enter" Ta "Choose selected item"
.It Li "Up" Ta "Select previous item"
.It Li "Down" Ta "Select next item"
+.It Li "+" Ta "Expand selected item"
+.It Li "-" Ta "Collapse selected item"
+.It Li "M-+" Ta "Expand all items"
+.It Li "M--" Ta "Collapse all items"
.It Li "x" Ta "Kill selected item"
.It Li "X" Ta "Kill tagged items"
.It Li "<" Ta "Scroll list of previews left"