summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-09-20 04:46:44 +0200
committerhut <hut@lepus.uberspace.de>2015-09-20 04:47:52 +0200
commitf33ea2bc7b12f77f28f7e6b1017ddeca2c2b6335 (patch)
tree7575f6df3e336c4ad7dda97b7015dce007050e3c
parent2bf1362a087bc4043d838264657d5ac7755d74bc (diff)
downloadranger-f33ea2bc7b12f77f28f7e6b1017ddeca2c2b6335.tar.gz
gui.mouse_event: fix scroll down in recent ncurses versions
-rw-r--r--ranger/gui/mouse_event.py3
1 files changed, 3 insertions, 0 deletions
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: