]> Sergey Matveev's repositories - nnn.git/commitdiff
Disable rollover at edges on scroll
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 2 Dec 2019 12:54:59 +0000 (18:24 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 2 Dec 2019 12:54:59 +0000 (18:24 +0530)
src/nnn.c

index 3d8db0e99de1eea8bb780d76a2df9c30f73c8b84..54ff48f86fb0b7e9d69105e496987d161f939c12 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4303,13 +4303,14 @@ nochange:
 
 #if NCURSES_MOUSE_VERSION > 1
                        /* Scroll up */
-                       if (event.bstate == BUTTON4_PRESSED && ndents) {
+                       if (event.bstate == BUTTON4_PRESSED && ndents && (cfg.rollover || cur)) {
                                move_cursor((cur + ndents - 1) % ndents, 0);
                                break;
                        }
 
                        /* Scroll down */
-                       if (event.bstate == BUTTON5_PRESSED && ndents) {
+                       if (event.bstate == BUTTON5_PRESSED && ndents
+                           && (cfg.rollover || (cur != ndents - 1))) {
                                move_cursor((cur + 1) % ndents, 0);
                                break;
                        }