Commit Diff


commit - d452fa095c7213013b27697e7e2752eadca53781
commit + 9bfc94779c7b8c259aecb12264e190fd0be58343
blob - dd127a64731249bc200db720dd1d4436cabc6cab
blob + a95eee4bdfb22a5b224b3805ca639fab7914738d
--- rover.c
+++ rover.c
@@ -367,7 +367,7 @@ update_view()
     mvaddnwstr(0, 0, WBUF, COLS - 4 - numsize);
     wcolor_set(rover.window, RVC_BORDER, NULL);
     wborder(rover.window, 0, 0, 0, 0, 0, 0, 0, 0);
-    ESEL = MIN(ESEL, rover.nfiles - 1);
+    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);