Merge remote-tracking branch 'origin/pr/3626'
This commit is contained in:
commit
de0aa32c11
@ -1778,10 +1778,10 @@ class CommandDispatcher:
|
|||||||
"""
|
"""
|
||||||
self.set_mark("'")
|
self.set_mark("'")
|
||||||
tab = self._current_widget()
|
tab = self._current_widget()
|
||||||
if tab.search.search_displayed:
|
|
||||||
tab.search.clear()
|
|
||||||
|
|
||||||
if not text:
|
if not text:
|
||||||
|
if tab.search.search_displayed:
|
||||||
|
tab.search.clear()
|
||||||
return
|
return
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -184,6 +184,12 @@ class WebEngineSearch(browsertab.AbstractSearch):
|
|||||||
|
|
||||||
def search(self, text, *, ignore_case='never', reverse=False,
|
def search(self, text, *, ignore_case='never', reverse=False,
|
||||||
result_cb=None):
|
result_cb=None):
|
||||||
|
# Don't go to next entry on duplicate search
|
||||||
|
if self.text == text and self.search_displayed:
|
||||||
|
log.webview.debug("Ignoring duplicate search request"
|
||||||
|
" for {}".format(text))
|
||||||
|
return
|
||||||
|
|
||||||
self.text = text
|
self.text = text
|
||||||
self._flags = QWebEnginePage.FindFlags(0)
|
self._flags = QWebEnginePage.FindFlags(0)
|
||||||
if self._is_case_sensitive(ignore_case):
|
if self._is_case_sensitive(ignore_case):
|
||||||
|
@ -147,8 +147,14 @@ class WebKitSearch(browsertab.AbstractSearch):
|
|||||||
|
|
||||||
def search(self, text, *, ignore_case='never', reverse=False,
|
def search(self, text, *, ignore_case='never', reverse=False,
|
||||||
result_cb=None):
|
result_cb=None):
|
||||||
self.search_displayed = True
|
# Don't go to next entry on duplicate search
|
||||||
|
if self.text == text and self.search_displayed:
|
||||||
|
log.webview.debug("Ignoring duplicate search request"
|
||||||
|
" for {}".format(text))
|
||||||
|
return
|
||||||
|
|
||||||
self.text = text
|
self.text = text
|
||||||
|
self.search_displayed = True
|
||||||
self._flags = QWebPage.FindWrapsAroundDocument
|
self._flags = QWebPage.FindWrapsAroundDocument
|
||||||
if self._is_case_sensitive(ignore_case):
|
if self._is_case_sensitive(ignore_case):
|
||||||
self._flags |= QWebPage.FindCaseSensitively
|
self._flags |= QWebPage.FindCaseSensitively
|
||||||
|
@ -52,6 +52,12 @@ Feature: Searching on a page
|
|||||||
And I wait for "search didn't find blub" in the log
|
And I wait for "search didn't find blub" in the log
|
||||||
Then the warning "Text 'blub' not found on page!" should be shown
|
Then the warning "Text 'blub' not found on page!" should be shown
|
||||||
|
|
||||||
|
Scenario: Searching text duplicates
|
||||||
|
When I run :search foo
|
||||||
|
And I wait for "search found foo" in the log
|
||||||
|
And I run :search foo
|
||||||
|
Then "Ignoring duplicate search request for foo" should be logged
|
||||||
|
|
||||||
## search.ignore_case
|
## search.ignore_case
|
||||||
|
|
||||||
Scenario: Searching text with search.ignore_case = always
|
Scenario: Searching text with search.ignore_case = always
|
||||||
|
Loading…
Reference in New Issue
Block a user