From 0d2c7c8b5f21d4c4f9a2c9875557251dee58be92 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 20 Sep 2015 04:46:44 +0200 Subject: gui.mouse_event: fix scroll down in recent ncurses versions --- ranger/gui/mouse_event.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ranger/gui/mouse_event.py b/ranger/gui/mouse_event.py index f9207138..bc05b2b7 100644 --- a/ranger/gui/mouse_event.py +++ b/ranger/gui/mouse_event.py @@ -35,9 +35,12 @@ class MouseEvent(object): # If the bstate > ALL_MOUSE_EVENTS, it's an invalid mouse button. # I interpret invalid buttons as "scroll down" because all tested # systems have a broken curses implementation and this is a workaround. + # Recently it seems to have been fixed, as 2**21 was introduced as + # the code for the "scroll down" button. if self.bstate & curses.BUTTON4_PRESSED: return self.ctrl() and -self.CTRL_SCROLLWHEEL_MULTIPLIER or -1 elif self.bstate & curses.BUTTON2_PRESSED \ + or self.bstate & 2**21 \ or self.bstate > curses.ALL_MOUSE_EVENTS: return self.ctrl() and self.CTRL_SCROLLWHEEL_MULTIPLIER or 1 else: -- cgit 1.4.1-2-gfad0