diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 0b1806ac4..2ae0b1e93 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -46,6 +46,10 @@ Removed - The ability to display status messages from webpages, as well as the related `ui -> display-statusbar-messages` setting. +- The `general -> wrap-search` setting as searches now always wrap. + According to a quick straw poll and prior crash logs, almost nobody is using + `wrap-search = false`, and turning off wrapping is not possible with + QtWebEngine. Fixed ----- diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 8e883d9f5..1244e51fe 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -142,14 +142,13 @@ class AbstractSearch(QObject): self._widget = None self.text = None - def search(self, text, *, ignore_case=False, wrap=False, reverse=False, + def search(self, text, *, ignore_case=False, reverse=False, result_cb=None): """Find the given text on the page. Args: text: The text to search for. ignore_case: Search case-insensitively. (True/False/'smart') - wrap: Wrap around to the top when arriving at the bottom. reverse: Reverse search direction. result_cb: Called with a bool indicating whether a match was found. """ diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 785215eca..0117026b3 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1466,20 +1466,8 @@ class CommandDispatcher: message.info(self._win_id, "Search hit TOP, continuing at " "BOTTOM", immediately=True) else: - # User disabled wrapping; but findText() just returns False. If we - # have a selection, we know there's a match *somewhere* on the page - if not options['wrap'] and tab.caret.has_selection(): - if going_up: - message.warning(self._win_id, "Search hit TOP without " - "match for: {}".format(text), - immediately=True) - else: - message.warning(self._win_id, "Search hit BOTTOM without " - "match for: {}".format(text), - immediately=True) - else: - message.warning(self._win_id, "Text '{}' not found on " - "page!".format(text), immediately=True) + message.warning(self._win_id, "Text '{}' not found on " + "page!".format(text), immediately=True) @cmdutils.register(instance='command-dispatcher', scope='window', maxsplit=0) @@ -1496,7 +1484,6 @@ class CommandDispatcher: options = { 'ignore_case': config.get('general', 'ignore-case'), - 'wrap': config.get('general', 'wrap-search'), 'reverse': reverse, } self._tabbed_browser.search_text = text diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 438206a71..97cc8d270 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -72,7 +72,7 @@ class WebEngineSearch(browsertab.AbstractSearch): else: self._widget.findText(text, flags, cb) - def search(self, text, *, ignore_case=False, wrap=False, reverse=False, + def search(self, text, *, ignore_case=False, reverse=False, result_cb=None): flags = QWebEnginePage.FindFlags(0) if ignore_case == 'smart': diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 4784e9d00..8697d909d 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -85,7 +85,7 @@ class WebKitSearch(browsertab.AbstractSearch): self._widget.findText('') self._widget.findText('', QWebPage.HighlightAllOccurrences) - def search(self, text, *, ignore_case=False, wrap=False, reverse=False, + def search(self, text, *, ignore_case=False, reverse=False, result_cb=None): flags = QWebPage.FindFlags(0) if ignore_case == 'smart': @@ -93,8 +93,6 @@ class WebKitSearch(browsertab.AbstractSearch): flags |= QWebPage.FindCaseSensitively elif not ignore_case: flags |= QWebPage.FindCaseSensitively - if wrap: - flags |= QWebPage.FindWrapsAroundDocument if reverse: flags |= QWebPage.FindBackward # We actually search *twice* - once to highlight everything, then again diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 9278a1e61..05d55246d 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -352,6 +352,7 @@ class ConfigManager(QObject): ('tabs', 'auto-hide'), ('tabs', 'hide-always'), ('ui', 'display-statusbar-messages'), + ('general', 'wrap-search'), ] CHANGED_OPTIONS = { ('content', 'cookies-accept'): diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 5da42b59c..5447f8ed6 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -134,11 +134,6 @@ def data(readonly=False): SettingValue(typ.IgnoreCase(), 'smart'), "Whether to find text on a page case-insensitively."), - ('wrap-search', - SettingValue(typ.Bool(), 'true'), - "Whether to wrap finding text to the top when arriving at the " - "end."), - ('startpage', SettingValue(typ.List(), 'https://duckduckgo.com'), "The default page(s) to open at the start, separated by commas."), diff --git a/tests/end2end/features/search.feature b/tests/end2end/features/search.feature index 6cf1bcc82..fe54cc14a 100644 --- a/tests/end2end/features/search.feature +++ b/tests/end2end/features/search.feature @@ -146,42 +146,18 @@ Feature: Searching on a page ## wrapping Scenario: Wrapping around page - When I set general -> wrap-search to true - And I run :search foo + When I run :search foo And I run :search-next And I run :search-next And I run :yank-selected Then the clipboard should contain "foo" - Scenario: Wrapping around page with wrap-search = false - When I set general -> wrap-search to false - And I run :search foo - And I run :search-next - And I run :search-next - Then the warning "Search hit BOTTOM without match for: foo" should be shown - Scenario: Wrapping around page with --reverse - When I set general -> wrap-search to true - And I run :search --reverse foo + When I run :search --reverse foo And I run :search-next And I run :search-next And I run :yank-selected Then the clipboard should contain "Foo" - Scenario: Wrapping around page with wrap-search = false and --reverse - When I set general -> wrap-search to false - And I run :search --reverse foo - And I run :search-next - And I run :search-next - Then the warning "Search hit TOP without match for: foo" should be shown - - Scenario: Wrapping around page - When I set general -> wrap-search to true - And I run :search foo - And I run :search-next - And I run :search-next - And I run :yank-selected - Then the clipboard should contain "foo" - # TODO: wrapping message with scrolling # TODO: wrapping message without scrolling