diff options
author | hut <hut@lepus.uberspace.de> | 2014-04-23 20:40:19 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2014-04-23 20:40:19 +0200 |
commit | 7c869ebddb5148a6b5f62be8d2c871ce0f03da07 (patch) | |
tree | 1990182047ca11eeb2cbce92e69c04a8d29f57c7 /ranger | |
parent | 0ba6150eefe3572af00f801534228ad83c8f625c (diff) | |
download | ranger-7c869ebddb5148a6b5f62be8d2c871ce0f03da07.tar.gz |
Workaround in py3.4.0 for swapped x/y in curses addch()
See http://bugs.python.org/issue21088, https://github.com/hut/ranger/issues/122
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/curses_shortcuts.py | 5 | ||||
-rw-r--r-- | ranger/gui/widgets/browserview.py | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py index bc07f837..e75205d6 100644 --- a/ranger/gui/curses_shortcuts.py +++ b/ranger/gui/curses_shortcuts.py @@ -4,10 +4,13 @@ import curses import _curses +import sys from ranger.gui.color import get_color from ranger.core.shared import SettingsAware +REVERSE_ADDCH_ARGS = sys.version[0:5] == '3.4.0' + def _fix_surrogates(args): return [isinstance(arg, str) and arg.encode('utf-8', 'surrogateescape') .decode('utf-8', 'replace') or arg for arg in args] @@ -43,6 +46,8 @@ class CursesShortcuts(SettingsAware): pass def addch(self, *args): + if REVERSE_ADDCH_ARGS and len(args) >= 3: + args = [args[1], args[0]] + list(args[2:]) try: self.win.addch(*args) except: diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index 1f2dd457..618d15a8 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -163,8 +163,8 @@ class BrowserView(Widget, DisplayableContainer): y = self.hei - 1 try: win.vline(1, x, curses.ACS_VLINE, y - 1) - win.addch(0, x, curses.ACS_TTEE, 0) - win.addch(y, x, curses.ACS_BTEE, 0) + self.addch(0, x, curses.ACS_TTEE, 0) + self.addch(y, x, curses.ACS_BTEE, 0) except: # in case it's off the boundaries pass |