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
|
- The ability to display status messages from webpages, as well as the related
|
||||||
`ui -> display-statusbar-messages` setting.
|
`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
|
Fixed
|
||||||
-----
|
-----
|
||||||
|
@ -142,14 +142,13 @@ class AbstractSearch(QObject):
|
|||||||
self._widget = None
|
self._widget = None
|
||||||
self.text = 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):
|
result_cb=None):
|
||||||
"""Find the given text on the page.
|
"""Find the given text on the page.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text: The text to search for.
|
text: The text to search for.
|
||||||
ignore_case: Search case-insensitively. (True/False/'smart')
|
ignore_case: Search case-insensitively. (True/False/'smart')
|
||||||
wrap: Wrap around to the top when arriving at the bottom.
|
|
||||||
reverse: Reverse search direction.
|
reverse: Reverse search direction.
|
||||||
result_cb: Called with a bool indicating whether a match was found.
|
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 "
|
message.info(self._win_id, "Search hit TOP, continuing at "
|
||||||
"BOTTOM", immediately=True)
|
"BOTTOM", immediately=True)
|
||||||
else:
|
else:
|
||||||
# User disabled wrapping; but findText() just returns False. If we
|
message.warning(self._win_id, "Text '{}' not found on "
|
||||||
# have a selection, we know there's a match *somewhere* on the page
|
"page!".format(text), immediately=True)
|
||||||
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)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
maxsplit=0)
|
maxsplit=0)
|
||||||
@ -1496,7 +1484,6 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
options = {
|
options = {
|
||||||
'ignore_case': config.get('general', 'ignore-case'),
|
'ignore_case': config.get('general', 'ignore-case'),
|
||||||
'wrap': config.get('general', 'wrap-search'),
|
|
||||||
'reverse': reverse,
|
'reverse': reverse,
|
||||||
}
|
}
|
||||||
self._tabbed_browser.search_text = text
|
self._tabbed_browser.search_text = text
|
||||||
|
@ -72,7 +72,7 @@ class WebEngineSearch(browsertab.AbstractSearch):
|
|||||||
else:
|
else:
|
||||||
self._widget.findText(text, flags, cb)
|
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):
|
result_cb=None):
|
||||||
flags = QWebEnginePage.FindFlags(0)
|
flags = QWebEnginePage.FindFlags(0)
|
||||||
if ignore_case == 'smart':
|
if ignore_case == 'smart':
|
||||||
|
@ -85,7 +85,7 @@ class WebKitSearch(browsertab.AbstractSearch):
|
|||||||
self._widget.findText('')
|
self._widget.findText('')
|
||||||
self._widget.findText('', QWebPage.HighlightAllOccurrences)
|
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):
|
result_cb=None):
|
||||||
flags = QWebPage.FindFlags(0)
|
flags = QWebPage.FindFlags(0)
|
||||||
if ignore_case == 'smart':
|
if ignore_case == 'smart':
|
||||||
@ -93,8 +93,6 @@ class WebKitSearch(browsertab.AbstractSearch):
|
|||||||
flags |= QWebPage.FindCaseSensitively
|
flags |= QWebPage.FindCaseSensitively
|
||||||
elif not ignore_case:
|
elif not ignore_case:
|
||||||
flags |= QWebPage.FindCaseSensitively
|
flags |= QWebPage.FindCaseSensitively
|
||||||
if wrap:
|
|
||||||
flags |= QWebPage.FindWrapsAroundDocument
|
|
||||||
if reverse:
|
if reverse:
|
||||||
flags |= QWebPage.FindBackward
|
flags |= QWebPage.FindBackward
|
||||||
# We actually search *twice* - once to highlight everything, then again
|
# We actually search *twice* - once to highlight everything, then again
|
||||||
|
@ -352,6 +352,7 @@ class ConfigManager(QObject):
|
|||||||
('tabs', 'auto-hide'),
|
('tabs', 'auto-hide'),
|
||||||
('tabs', 'hide-always'),
|
('tabs', 'hide-always'),
|
||||||
('ui', 'display-statusbar-messages'),
|
('ui', 'display-statusbar-messages'),
|
||||||
|
('general', 'wrap-search'),
|
||||||
]
|
]
|
||||||
CHANGED_OPTIONS = {
|
CHANGED_OPTIONS = {
|
||||||
('content', 'cookies-accept'):
|
('content', 'cookies-accept'):
|
||||||
|
@ -134,11 +134,6 @@ def data(readonly=False):
|
|||||||
SettingValue(typ.IgnoreCase(), 'smart'),
|
SettingValue(typ.IgnoreCase(), 'smart'),
|
||||||
"Whether to find text on a page case-insensitively."),
|
"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',
|
('startpage',
|
||||||
SettingValue(typ.List(), 'https://duckduckgo.com'),
|
SettingValue(typ.List(), 'https://duckduckgo.com'),
|
||||||
"The default page(s) to open at the start, separated by commas."),
|
"The default page(s) to open at the start, separated by commas."),
|
||||||
|
@ -146,42 +146,18 @@ Feature: Searching on a page
|
|||||||
## wrapping
|
## wrapping
|
||||||
|
|
||||||
Scenario: Wrapping around page
|
Scenario: Wrapping around page
|
||||||
When I set general -> wrap-search to true
|
When I run :search foo
|
||||||
And I run :search foo
|
|
||||||
And I run :search-next
|
And I run :search-next
|
||||||
And I run :search-next
|
And I run :search-next
|
||||||
And I run :yank-selected
|
And I run :yank-selected
|
||||||
Then the clipboard should contain "foo"
|
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
|
Scenario: Wrapping around page with --reverse
|
||||||
When I set general -> wrap-search to true
|
When I run :search --reverse foo
|
||||||
And I run :search --reverse foo
|
|
||||||
And I run :search-next
|
And I run :search-next
|
||||||
And I run :search-next
|
And I run :search-next
|
||||||
And I run :yank-selected
|
And I run :yank-selected
|
||||||
Then the clipboard should contain "Foo"
|
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 with scrolling
|
||||||
# TODO: wrapping message without scrolling
|
# TODO: wrapping message without scrolling
|
||||||
|
Loading…
Reference in New Issue
Block a user