Emulate webkit duplicate search behavior on webengine

This commit is contained in:
Jay Kamat 2018-02-23 17:49:47 -05:00
parent ada15510a7
commit f926e7b850
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 7 additions and 2 deletions

View File

@ -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 = {

View File

@ -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):