From f926e7b850835fab7bfcde3a24d3faebee99562c Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Fri, 23 Feb 2018 17:49:47 -0500 Subject: [PATCH] Emulate webkit duplicate search behavior on webengine --- qutebrowser/browser/commands.py | 4 ++-- qutebrowser/browser/webengine/webenginetab.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 69cb3142f..6c2e3da8c 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1778,10 +1778,10 @@ class CommandDispatcher: """ self.set_mark("'") tab = self._current_widget() - if tab.search.search_displayed: - tab.search.clear() if not text: + if tab.search.search_displayed: + tab.search.clear() return options = { diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 4595f7a6e..1b0ee5541 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -183,6 +183,11 @@ class WebEngineSearch(browsertab.AbstractSearch): def search(self, text, *, ignore_case='never', reverse=False, result_cb=None): + # When duplicate searching, don't search again (webkit behavior) + if self.text == text and self.search_displayed: + log.webview.debug("Ignoring duplicate search request") + return + self.text = text self._flags = QWebEnginePage.FindFlags(0) if self._is_case_sensitive(ignore_case):