diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2019-01-27 16:09:23 +0100 |
---|---|---|
committer | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2019-01-27 16:09:23 +0100 |
commit | 44d4f0be00109d8035ec9f158810c0251803e0fc (patch) | |
tree | 61e661e3e529261b523dab46712f1cafee8bb6a1 /ranger | |
parent | f176b031c6e67553ed957e21468e99b1663ba0e7 (diff) | |
download | ranger-44d4f0be00109d8035ec9f158810c0251803e0fc.tar.gz |
Alternative approach to #1452 (which didn't seem to work)
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/gui/curses_shortcuts.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py index b507a5c2..8dce5869 100644 --- a/ranger/gui/curses_shortcuts.py +++ b/ranger/gui/curses_shortcuts.py @@ -14,7 +14,7 @@ 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').replace(u'\u0000', '') or arg for arg in args] + .decode('utf-8', 'replace') or arg for arg in args] class CursesShortcuts(SettingsAware): @@ -43,7 +43,7 @@ class CursesShortcuts(SettingsAware): try: self.win.addstr(*_fix_surrogates(args)) - except (curses.error, UnicodeError): + except (curses.error, UnicodeError, ValueError): pass def addnstr(self, *args): @@ -51,13 +51,13 @@ class CursesShortcuts(SettingsAware): try: self.win.addnstr(*args) - except (curses.error, TypeError): + except (curses.error, TypeError, ValueError): if len(args) > 2: self.win.move(y, x) try: self.win.addnstr(*_fix_surrogates(args)) - except (curses.error, UnicodeError): + except (curses.error, UnicodeError, ValueError): pass def addch(self, *args): |