Clear selection when setting completion pattern.
It doesn't make sense to have an active selection while you are filtering by entering text. You should be in one of two states: 1. Tabbing through completions (valid selection) 2. Entering a filter pattern (invalid selection) Fixes #2843, where a crash would occur after the following: 1. tab to an item other than the first 2. <backspace> 3. re-type last character 4. <ctrl-d> This would try to delete an out of range index.
This commit is contained in:
parent
bc21904fef
commit
b61691684e
@ -297,6 +297,7 @@ class CompletionView(QTreeView):
|
||||
self.pattern = pattern
|
||||
with debug.log_time(log.completion, 'Set pattern {}'.format(pattern)):
|
||||
self.model().set_pattern(pattern)
|
||||
self.selectionModel().clear()
|
||||
self._maybe_update_geometry()
|
||||
self._maybe_show()
|
||||
|
||||
|
@ -87,6 +87,7 @@ def test_set_pattern(completionview):
|
||||
completionview.set_model(model)
|
||||
completionview.set_pattern('foo')
|
||||
model.set_pattern.assert_called_with('foo')
|
||||
assert not completionview.selectionModel().currentIndex().isValid()
|
||||
|
||||
|
||||
def test_set_pattern_no_model(completionview):
|
||||
|
Loading…
Reference in New Issue
Block a user