diff options
author | Spiros Georgaras <sng@hellug.gr> | 2019-01-25 04:10:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 04:10:12 +0200 |
commit | 4f26e90410aaf8f70b51654d91631ac2a46c5194 (patch) | |
tree | aa57997630633f1f7a43e1bb444886dbcc5fd019 | |
parent | f9de84dd51bd6baa4de2cccbcf0c77569e5552c7 (diff) | |
download | ranger-4f26e90410aaf8f70b51654d91631ac2a46c5194.tar.gz |
fix Ctrl+Space crash
When in input mode (e.g. search, :mkdir, :rename, etc.), pressing Ctrl+Space makes ranger crash This will fix this issue Crash example: ``` ranger version: ranger-master 1.9.2 Python version: 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127] Locale: el_GR.UTF-8 Current file: '/home/spiros/1. "aaa" \'aaa\'' Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/ranger/gui/curses_shortcuts.py", line 36, in addstr self.win.addstr(*args) ValueError: embedded null character During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/ranger/core/main.py", line 195, in main fm.loop() File "/usr/lib/python3.7/site-packages/ranger/core/fm.py", line 394, in loop ui.redraw() File "/usr/lib/python3.7/site-packages/ranger/gui/ui.py", line 338, in redraw self.draw() File "/usr/lib/python3.7/site-packages/ranger/gui/ui.py", line 365, in draw DisplayableContainer.draw(self) File "/usr/lib/python3.7/site-packages/ranger/gui/displayable.py", line 256, in draw displayable.draw() File "/usr/lib/python3.7/site-packages/ranger/gui/widgets/console.py", line 111, in draw self.addstr(0, len(self.prompt), str(line[x:])) File "/usr/lib/python3.7/site-packages/ranger/gui/curses_shortcuts.py", line 44, in addstr self.win.addstr(*_fix_surrogates(args)) ValueError: embedded null character ranger crashed. Please report this traceback at: https://github.com/ranger/ranger/issues ```
-rw-r--r-- | ranger/gui/curses_shortcuts.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py index 14f1e0e4..b9fcbaf5 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') or arg for arg in args] + .decode('utf-8', 'replace').replace('\u0000', '') or arg for arg in args] class CursesShortcuts(SettingsAware): |