login

<     >

2015-06-14 13:37:19 (UTC-03:00)

Marcel Rodrigues <marcelgmr@gmail.com>

Remove wrap-around behavior from 'j' & 'k'.

That behavior provided a way to easily move between the top and
bottom of listing. However, this is no longer needed due to the
recent addition of 'g' & 'G'. The new behavior is also more similar
to what we are used to in other programs.

diff --git a/rover.c b/rover.c
index 518be41..25585b4 100644
--- a/rover.c
+++ b/rover.c
@@ -870,11 +870,11 @@ main(int argc, char *argv[])
             spawn();
         } else if (!strcmp(key, RVK_DOWN)) {
             if (!rover.nfiles) continue;
-            ESEL = (ESEL + 1) % rover.nfiles;
+            ESEL = MIN(ESEL + 1, rover.nfiles - 1);
             update_view();
         } else if (!strcmp(key, RVK_UP)) {
             if (!rover.nfiles) continue;
-            ESEL = ESEL ? ESEL - 1 : rover.nfiles - 1;
+            ESEL = MAX(ESEL - 1, 0);
             update_view();
         } else if (!strcmp(key, RVK_JUMP_DOWN)) {
             if (!rover.nfiles) continue;