Fix completion selection bug.
Fix the issue where pressing `o<esc>o` would show a url completion dialog where attempting to <Tab> select items would do nothing but show a Qt warning. The fix is to ensure we set _last_completion_func to None whenever we clear completion (there was a case I missed). It also ensures we always delete the old model and adds a safety to prevent deleting an in-use model is set_model is called with the current model.
This commit is contained in:
parent
fa39b82b3c
commit
61a1709141
@ -211,6 +211,7 @@ class Completer(QObject):
|
||||
# FIXME complete searches
|
||||
# https://github.com/qutebrowser/qutebrowser/issues/32
|
||||
completion.set_model(None)
|
||||
self._last_completion_func = None
|
||||
return
|
||||
|
||||
before_cursor, pattern, after_cursor = self._partition()
|
||||
|
@ -269,17 +269,18 @@ class CompletionView(QTreeView):
|
||||
Args:
|
||||
model: The model to use.
|
||||
"""
|
||||
if self.model() is not None and model is not self.model():
|
||||
self.model().deleteLater()
|
||||
self.selectionModel().deleteLater()
|
||||
|
||||
self.setModel(model)
|
||||
|
||||
if model is None:
|
||||
self._active = False
|
||||
self.hide()
|
||||
return
|
||||
|
||||
if self.model() is not None:
|
||||
self.model().deleteLater()
|
||||
self.selectionModel().deleteLater()
|
||||
|
||||
model.setParent(self)
|
||||
self.setModel(model)
|
||||
self._active = True
|
||||
self._maybe_show()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user