aboutsummaryrefslogtreecommitdiff
path: root/mode-tree.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2017-08-29 11:13:54 +0100
committerNicholas Marriott <nicholas.marriott@gmail.com>2017-08-29 11:13:54 +0100
commit91d6bff8b83cea34d348172db56dd28baafbda80 (patch)
tree5e275e0eba9cc056652abcfc478df2f4532fa5f5 /mode-tree.c
parent5cdccf78a1baa5757a42e78e6b89266f89a37034 (diff)
parent7d3bf6453ec43f03ff98231c5ced5a2979550f84 (diff)
downloadrtmux-91d6bff8b83cea34d348172db56dd28baafbda80.tar.gz
rtmux-91d6bff8b83cea34d348172db56dd28baafbda80.tar.bz2
rtmux-91d6bff8b83cea34d348172db56dd28baafbda80.zip
Merge branch 'master' of github.com:tmux/tmux
Diffstat (limited to 'mode-tree.c')
-rw-r--r--mode-tree.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mode-tree.c b/mode-tree.c
index 4e11a3b4..fc31592a 100644
--- a/mode-tree.c
+++ b/mode-tree.c
@@ -870,6 +870,15 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
case 'v':
mtd->preview = !mtd->preview;
mode_tree_build(mtd);
+
+ /*
+ * If the current line would now be off screen now the preview
+ * is on, reset the the offset to the last visible line.
+ */
+ if (mtd->preview && mtd->current > mtd->height - 1) {
+ mtd->offset = mtd->current - mtd->height;
+ mtd->current--;
+ }
break;
}
return (0);