completion: Use textEdited instead of textChanged
This gets rid of _ignore_next and some unneeded logic, since textEdited won't even emit if we edited it programatically.
This commit is contained in:
parent
903d1876af
commit
adfc96cdfa
@ -312,7 +312,7 @@ class QuteBrowser(QApplication):
|
||||
cmd.clear_completion_selection.connect(
|
||||
completion.on_clear_completion_selection)
|
||||
cmd.hide_completion.connect(completion.hide)
|
||||
cmd.textChanged.connect(completion.on_cmd_text_changed)
|
||||
cmd.textEdited.connect(completion.on_cmd_text_changed)
|
||||
completion.change_completed_part.connect(cmd.on_change_completed_part)
|
||||
|
||||
def _recover_pages(self):
|
||||
|
@ -59,7 +59,6 @@ class CompletionView(QTreeView):
|
||||
_model: The currently active filter model.
|
||||
_lastmodel: The model set in the last iteration.
|
||||
_completion_models: dict of available completion models.
|
||||
_ignore_next: Whether to ignore the next cmd_text_changed signal.
|
||||
_enabled: Whether showing the CompletionView is enabled.
|
||||
_completing: Whether we're currently completing something.
|
||||
_height: The height to use for the CompletionView.
|
||||
@ -124,7 +123,6 @@ class CompletionView(QTreeView):
|
||||
opt, self)))
|
||||
except NoCompletionsError:
|
||||
pass
|
||||
self._ignore_next = False
|
||||
self._completing = False
|
||||
|
||||
self._delegate = _CompletionItemDelegate(self)
|
||||
@ -219,7 +217,6 @@ class CompletionView(QTreeView):
|
||||
QItemSelectionModel.Rows)
|
||||
data = self._model.data(idx)
|
||||
if data is not None:
|
||||
self._ignore_next = True
|
||||
self.change_completed_part.emit(data)
|
||||
|
||||
def set_model(self, model):
|
||||
@ -254,11 +251,6 @@ class CompletionView(QTreeView):
|
||||
text: The new text
|
||||
"""
|
||||
# FIXME we should also consider the cursor position
|
||||
if self._ignore_next:
|
||||
# Text changed by a completion, so we don't have to complete again.
|
||||
self._ignore_next = False
|
||||
return
|
||||
|
||||
if not text.startswith(':'):
|
||||
# This is a search or gibberish, so we don't need to complete
|
||||
# anything (yet)
|
||||
|
Loading…
Reference in New Issue
Block a user