]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix rollover bug
authorlvgx <l@vgx.fr>
Tue, 29 Sep 2020 13:41:22 +0000 (15:41 +0200)
committerGitHub <noreply@github.com>
Tue, 29 Sep 2020 13:41:22 +0000 (15:41 +0200)
Fixes #743

src/nnn.c

index 5110a14f6ec675960db6f20487abdc71c2bd06d3..f97ad21c6ad1dec50633911b3b79e16ca9bf1744 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5972,14 +5972,14 @@ nochange:
                        }
 #if NCURSES_MOUSE_VERSION > 1
                        /* Scroll up */
-                       if (event.bstate == BUTTON4_PRESSED && ndents && (cfg.rollover || cur)) {
+                       if (event.bstate == BUTTON4_PRESSED && ndents && (cfg.rollover || cur >= scroll_lines)) {
                                move_cursor((cur + ndents - scroll_lines) % ndents, 0);
                                break;
                        }
 
                        /* Scroll down */
                        if (event.bstate == BUTTON5_PRESSED && ndents
-                           && (cfg.rollover || (cur != ndents - 1))) {
+                           && (cfg.rollover || (cur + scroll_lines < ndents))) {
                                move_cursor((cur + scroll_lines) % ndents, 0);
                                break;
                        }