Remove general -> wrap-search
This commit is contained in:
parent
f0da508c21
commit
64b32ec87d
@ -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
|
||||
-----
|
||||
|
@ -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.
|
||||
"""
|
||||
|
@ -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
|
||||
|
@ -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':
|
||||
|
@ -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
|
||||
|
@ -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'):
|
||||
|
@ -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."),
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user