3 files changed
@@ -23,15 +23,15 @@ def current_word(cursor_offset, line): | |||
| 23 | 23 | ||
| 24 | 24 | def current_dict_key(cursor_offset, line): | |
| 25 | 25 | """If in dictionary completion, return the current key""" | |
| 26 | - matches = list(re.finditer(r'[\w_][\w0-9._]*\[([\w0-9._(), ]*)', line)) | ||
| 26 | + matches = list(re.finditer(r'''[\w_][\w0-9._]*\[([\w0-9._(), '"]*)''', line)) | ||
| 27 | 27 | for m in matches: | |
| 28 | 28 | if m.start(1) <= cursor_offset and m.end(1) >= cursor_offset: | |
| 29 | 29 | return (m.start(1), m.end(1), m.group(1)) | |
| 30 | 30 | return None | |
| 31 | 31 | ||
| 32 | 32 | def current_dict(cursor_offset, line): | |
| 33 | 33 | """If in dictionary completion, return the dict that should be used""" | |
| 34 | - matches = list(re.finditer(r'([\w_][\w0-9._]*)\[([\w0-9._(), ]*)', line)) | ||
| 34 | + matches = list(re.finditer(r'''([\w_][\w0-9._]*)\[([\w0-9._(), '"]*)''', line)) | ||
| 35 | 35 | for m in matches: | |
| 36 | 36 | if m.start(2) <= cursor_offset and m.end(2) >= cursor_offset: | |
| 37 | 37 | return (m.start(1), m.end(1), m.group(1)) | |
@@ -336,7 +336,7 @@ def update(self, cursor_offset, current_line, matches, completer): | |||
| 336 | 336 | assert matches is not None | |
| 337 | 337 | self.matches = matches | |
| 338 | 338 | self.completer = completer | |
| 339 | - assert self.completer.locate(self.orig_cursor_offset, self.orig_line) is not None, (self.completer.locate, self.orig_cursor_offset, self.orig_line) | ||
| 339 | + #assert self.completer.locate(self.orig_cursor_offset, self.orig_line) is not None, (self.completer.locate, self.orig_cursor_offset, self.orig_line) | ||
| 340 | 340 | self.index = -1 | |
| 341 | 341 | self.start, self.end, self.current_word = self.completer.locate(self.orig_cursor_offset, self.orig_line) | |
| 342 | 342 | ||
@@ -133,6 +133,7 @@ def test_simple(self): | |||
| 133 | 133 | self.assertAccess('asdf[<(1, >|]') | |
| 134 | 134 | self.assertAccess('asdf[<(1, 2)>|]') | |
| 135 | 135 | #TODO self.assertAccess('d[d[<12|>') | |
| 136 | + self.assertAccess("d[<'a>|") | ||
| 136 | 137 | ||
| 137 | 138 | class TestCurrentDict(LineTestCase): | |
| 138 | 139 | def setUp(self): | |
0 commit comments