Commit a7f83bd
committed
gh-130472: Remove readline-only hacks from PyREPL completions
PyREPL was still carrying over two readline-specific tricks from the
fancy completer: a synthetic CSI prefix to influence sorting and a fake
blank completion entry to suppress readline's prefix insertion. Those
workarounds are not appropriate in PyREPL because the reader already
owns completion ordering and menu rendering, so the fake entries leaked
into the UI as real terminal attributes and empty menu cells.
Sort completion candidates in ReadlineAlikeReader by their visible text
with stripcolor(), and let the fancy completer return only real matches.
That keeps colored completions stable without emitting bogus escape
sequences, removes the empty completion slot, and adds regression tests
for both the low-level completer output and the reader integration.1 parent acf5229 commit a7f83bd
File tree
4 files changed
+46
-41
lines changed- Lib
- _pyrepl
- test/test_pyrepl
4 files changed
+46
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 108 | | |
112 | 109 | | |
113 | 110 | | |
| |||
173 | 170 | | |
174 | 171 | | |
175 | 172 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
185 | 179 | | |
186 | 180 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 181 | + | |
191 | 182 | | |
192 | 183 | | |
193 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | 162 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
172 | 167 | | |
173 | 168 | | |
174 | 169 | | |
175 | | - | |
| 170 | + | |
176 | 171 | | |
177 | | - | |
| 172 | + | |
178 | 173 | | |
179 | 174 | | |
180 | 175 | | |
| |||
197 | 192 | | |
198 | 193 | | |
199 | 194 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 195 | + | |
203 | 196 | | |
204 | 197 | | |
205 | 198 | | |
206 | | - | |
| 199 | + | |
207 | 200 | | |
208 | 201 | | |
209 | 202 | | |
210 | 203 | | |
211 | 204 | | |
212 | 205 | | |
213 | 206 | | |
214 | | - | |
215 | | - | |
216 | | - | |
| 207 | + | |
| 208 | + | |
217 | 209 | | |
218 | 210 | | |
219 | 211 | | |
220 | | - | |
| 212 | + | |
221 | 213 | | |
222 | 214 | | |
223 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
999 | 1000 | | |
1000 | 1001 | | |
1001 | 1002 | | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
1002 | 1024 | | |
1003 | 1025 | | |
1004 | 1026 | | |
| |||
0 commit comments