login

<     >

2014-11-11 20:31:55 (UTC-02:00)

Marcel Rodrigues <marcelgmr@gmail.com>

Guarantee selection visibility.

diff --git a/rover.c b/rover.c
index 0bfc215..e8d0c01 100644
--- a/rover.c
+++ b/rover.c
@@ -126,6 +126,12 @@ update()
     wcolor_set(rover.window, RVC_BORDER, NULL);
     wborder(rover.window, 0, 0, 0, 0, 0, 0, 0, 0);
     wcolor_set(rover.window, DEFAULT, NULL);
+    /* Selection might not be visible, due to window shrinking.
+       In that case the scroll must be moved to make it visible again. */
+    if (FSEL < SCROLL)
+        SCROLL = FSEL;
+    else if (FSEL >= SCROLL + HEIGHT)
+        SCROLL = FSEL - HEIGHT + 1;
     for (i = 0, j = SCROLL; i < HEIGHT && j < rover.nfiles; i++, j++) {
         ishidden = FNAME(j)[0] == '.';
         isdir = strchr(FNAME(j), '/') != NULL;