summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSpiros Georgaras <sng@hellug.gr>2019-01-25 04:10:12 +0200
committerGitHub <noreply@github.com>2019-01-25 04:10:12 +0200
commit4f26e90410aaf8f70b51654d91631ac2a46c5194 (patch)
treeaa57997630633f1f7a43e1bb444886dbcc5fd019
parentf9de84dd51bd6baa4de2cccbcf0c77569e5552c7 (diff)
downloadranger-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.py2
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):
lt;vc@akkartik.com> 2020-05-28 22:31:52 -0700 committer Kartik Agaram <vc@akkartik.com> 2020-05-28 22:31:52 -0700 6422 - size-of for handles' href='/akkartik/mu/commit/105files.subx?h=main&id=583a966d3e0b0f0e0fa9166986c877fda0643196'>583a966d ^
3962ac59 ^
583a966d ^

7d15b088 ^
3962ac59 ^



3962ac59 ^



3962ac59 ^



492fb278 ^

















































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169