From adfc96cdfafdd4a268c31a5fdfa096d999cf0fff Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 30 Apr 2014 11:52:30 +0200 Subject: [PATCH] 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. --- qutebrowser/app.py | 2 +- qutebrowser/widgets/_completion.py | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index a9bcaa840..612680b92 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -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): diff --git a/qutebrowser/widgets/_completion.py b/qutebrowser/widgets/_completion.py index 940896e4f..e8546b48b 100644 --- a/qutebrowser/widgets/_completion.py +++ b/qutebrowser/widgets/_completion.py @@ -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)