src/nnn.c | 22 ++++++++++++++++++++++ diff --git a/src/nnn.c b/src/nnn.c index 3454359961362f2b2941a1aa8d26bd0424a599be..8e841c132b7b9d034af75b6a897280e02c496997 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -911,7 +911,12 @@ noecho(); nonl(); //intrflush(stdscr, FALSE); keypad(stdscr, TRUE); +#if NCURSES_MOUSE_VERSION <= 1 mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON2_CLICKED, NULL); +#else + mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON2_CLICKED + | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL); +#endif mouseinterval(400); curs_set(FALSE); /* Hide cursor */ start_color(); @@ -3354,6 +3359,23 @@ setdirwatch(); goto begin; } + +#if NCURSES_MOUSE_VERSION > 1 + if (event.bstate == BUTTON4_PRESSED || event.bstate == BUTTON5_PRESSED) + { + /* Scroll up */ + if (event.bstate == BUTTON4_PRESSED && ndents) { + move_cursor((cur + ndents - 1) % ndents, 0); + break; + } + + /* Scroll down */ + if (event.bstate == BUTTON5_PRESSED && ndents) { + move_cursor((cur + 1) % ndents, 0); + break; + } + } +#endif // Handle clicking on a context at the top: if (event.y == 0) {