diff options
author | nicm <nicm> | 2020-04-22 21:01:28 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-04-22 21:01:28 +0000 |
commit | 899b3d2436ffc49e264cc869ddf35e8a9d01522b (patch) | |
tree | 11898152f717685d52ef9e399622625ab1a717b8 /mode-tree.c | |
parent | 662728d6c7e1518e420ef430e85a44c249f8795f (diff) | |
download | rtmux-899b3d2436ffc49e264cc869ddf35e8a9d01522b.tar.gz rtmux-899b3d2436ffc49e264cc869ddf35e8a9d01522b.tar.bz2 rtmux-899b3d2436ffc49e264cc869ddf35e8a9d01522b.zip |
Indicate the marked pane in choose mode in reverse and add key to set
and clear it (m and M) and a key to jump to the starting pane (H).
Diffstat (limited to 'mode-tree.c')
-rw-r--r-- | mode-tree.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/mode-tree.c b/mode-tree.c index 0177d618..783ffcfa 100644 --- a/mode-tree.c +++ b/mode-tree.c @@ -256,8 +256,8 @@ mode_tree_expand_current(struct mode_tree_data *mtd) } } -void -mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag) +static int +mode_tree_get_tag(struct mode_tree_data *mtd, uint64_t tag, u_int *found) { u_int i; @@ -266,15 +266,41 @@ mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag) break; } if (i != mtd->line_size) { - mtd->current = i; + *found = i; + return (1); + } + return (0); +} + +void +mode_tree_expand(struct mode_tree_data *mtd, uint64_t tag) +{ + u_int found; + + if (!mode_tree_get_tag(mtd, tag, &found)) + return; + if (!mtd->line_list[found].item->expanded) { + mtd->line_list[found].item->expanded = 1; + mode_tree_build(mtd); + } +} + +int +mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag) +{ + u_int found; + + if (mode_tree_get_tag(mtd, tag, &found)) { + mtd->current = found; if (mtd->current > mtd->height - 1) mtd->offset = mtd->current - mtd->height + 1; else mtd->offset = 0; - } else { - mtd->current = 0; - mtd->offset = 0; + return (1); } + mtd->current = 0; + mtd->offset = 0; + return (0); } u_int |