If the selected line in the choose-tree list is in the area that would
otherwise be obscured next time the preview was shown, move the current
line to the bottom of the list.

Without this, scrolling appers to be "invisible" until the offset is
reset to the bottom of the list.
---
 mode-tree.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mode-tree.c b/mode-tree.c
index 4e11a3b4..131554a5 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 be obscured when the preview
+                * window reappeared next, reset the the offset to the last
+                * viible line on the screen.
+                */
+               if (mtd->preview && mtd->current > mtd->height - 1) {
+                       mtd->offset = mtd->current - mtd->height;
+                       mtd->current--;
+               }
                break;
        }
        return (0);
-- 
2.14.0

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to