Show More
@@ -1274,10 +1274,14 b' class IPCompleter(Completer):' | |||
|
1274 | 1274 | |
|
1275 | 1275 | def magic_color_matches(self, text:str) -> List[str] : |
|
1276 | 1276 | """ Match color schemes for %colors magic""" |
|
1277 |
texts = text. |
|
|
1278 | ||
|
1279 | if len(texts) > 0 and (texts[0] == 'colors' or texts[0] == '%colors'): | |
|
1280 | prefix = texts[1] if len(texts) > 1 else '' | |
|
1277 | texts = text.split() | |
|
1278 | if text.endswith(' '): | |
|
1279 | # .split() strips off the trailing whitespace. Add '' back | |
|
1280 | # so that: '%colors ' -> ['%colors', ''] | |
|
1281 | texts.append('') | |
|
1282 | ||
|
1283 | if len(texts) == 2 and (texts[0] == 'colors' or texts[0] == '%colors'): | |
|
1284 | prefix = texts[1] | |
|
1281 | 1285 | return [ color for color in InspectColors.keys() |
|
1282 | 1286 | if color.startswith(prefix) ] |
|
1283 | 1287 | return [] |
@@ -628,6 +628,8 b' def test_magic_color():' | |||
|
628 | 628 | nt.assert_in('%colors', matches) |
|
629 | 629 | s, matches = c.complete(None, 'colo') |
|
630 | 630 | nt.assert_not_in('NoColor', matches) |
|
631 | s, matches = c.complete(None, '%colors') # No trailing space | |
|
632 | nt.assert_not_in('NoColor', matches) | |
|
631 | 633 | s, matches = c.complete(None, 'colors ') |
|
632 | 634 | nt.assert_in('NoColor', matches) |
|
633 | 635 | s, matches = c.complete(None, '%colors ') |
General Comments 0
You need to be logged in to leave comments.
Login now