login

<     >

2015-08-09 14:04:27 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

Fix scroll after deleting files on background tab.

diff --git a/rover.c b/rover.c
index d39d9d4..145e353 100644
--- a/rover.c
+++ b/rover.c
@@ -377,7 +377,10 @@ update_view()
     ESEL = MAX(MIN(ESEL, rover.nfiles - 1), 0);
     /* Selection might not be visible, due to cursor wrapping or window
        shrinking. In that case, the scroll must be moved to make it visible. */
-    SCROLL = MAX(MIN(SCROLL, ESEL), ESEL - HEIGHT + 1);
+    if (rover.nfiles > HEIGHT)
+        SCROLL = MAX(MIN(SCROLL, ESEL), ESEL - HEIGHT + 1);
+    else
+        SCROLL = 0;
     marking = !strcmp(CWD, rover.marks.dirpath);
     for (i = 0, j = SCROLL; i < HEIGHT && j < rover.nfiles; i++, j++) {
         ishidden = ENAME(j)[0] == '.';