login

<     >

2015-07-28 13:19:44 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

Ensure selection doesn't go out of bounds.

diff --git a/rover.c b/rover.c
index 0a5e334..9b32587 100644
--- a/rover.c
+++ b/rover.c
@@ -367,6 +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);
     /* 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);