Merge branch 'krobelus-search'
This commit is contained in:
commit
6d1ac5d2a2
@ -131,9 +131,9 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Martin Zimmermann
|
* Martin Zimmermann
|
||||||
* Joel Torstensson
|
* Joel Torstensson
|
||||||
* Brian Jackson
|
* Brian Jackson
|
||||||
|
* Johannes Altmanninger
|
||||||
* Mathias Fussenegger
|
* Mathias Fussenegger
|
||||||
* Larry Hynes
|
* Larry Hynes
|
||||||
* Johannes Altmanninger
|
|
||||||
* Regina Hug
|
* Regina Hug
|
||||||
* Peter Vilim
|
* Peter Vilim
|
||||||
* Helen Sherwood-Taylor
|
* Helen Sherwood-Taylor
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|<<restart,restart>>|Restart qutebrowser while keeping existing tabs open.
|
|<<restart,restart>>|Restart qutebrowser while keeping existing tabs open.
|
||||||
|<<run-userscript,run-userscript>>|Run an userscript given as argument.
|
|<<run-userscript,run-userscript>>|Run an userscript given as argument.
|
||||||
|<<save,save>>|Save the config file.
|
|<<save,save>>|Save the config file.
|
||||||
|
|<<search,search>>|Search for a text on the current page.
|
||||||
|<<set,set>>|Set an option.
|
|<<set,set>>|Set an option.
|
||||||
|<<set-cmd-text,set-cmd-text>>|Preset the statusbar to some text.
|
|<<set-cmd-text,set-cmd-text>>|Preset the statusbar to some text.
|
||||||
|<<spawn,spawn>>|Spawn a command in a shell.
|
|<<spawn,spawn>>|Spawn a command in a shell.
|
||||||
@ -364,6 +365,18 @@ Run an userscript given as argument.
|
|||||||
=== save
|
=== save
|
||||||
Save the config file.
|
Save the config file.
|
||||||
|
|
||||||
|
[[search]]
|
||||||
|
=== search
|
||||||
|
Syntax: +:search [*--reverse*] 'text'+
|
||||||
|
|
||||||
|
Search for a text on the current page.
|
||||||
|
|
||||||
|
==== positional arguments
|
||||||
|
* +'text'+: The text to search for.
|
||||||
|
|
||||||
|
==== optional arguments
|
||||||
|
* +*-r*+, +*--reverse*+: Reverse search direction.
|
||||||
|
|
||||||
[[set]]
|
[[set]]
|
||||||
=== set
|
=== set
|
||||||
Syntax: +:set [*--temp*] ['section'] ['option'] ['value']+
|
Syntax: +:set [*--temp*] ['section'] ['option'] ['value']+
|
||||||
|
@ -71,12 +71,14 @@ class SearchRunner(QObject):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return utils.get_repr(self, text=self._text, flags=self._flags)
|
return utils.get_repr(self, text=self._text, flags=self._flags)
|
||||||
|
|
||||||
def _search(self, text, rev=False):
|
@pyqtSlot(str)
|
||||||
|
@cmdutils.register(instance='search-runner', scope='window', maxsplit=0)
|
||||||
|
def search(self, text, reverse=False):
|
||||||
"""Search for a text on the current page.
|
"""Search for a text on the current page.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text: The text to search for.
|
text: The text to search for.
|
||||||
rev: Search direction, True if reverse, else False.
|
reverse: Reverse search direction.
|
||||||
"""
|
"""
|
||||||
if self._text is not None and self._text != text:
|
if self._text is not None and self._text != text:
|
||||||
# We first clear the marked text, then the highlights
|
# We first clear the marked text, then the highlights
|
||||||
@ -92,7 +94,7 @@ class SearchRunner(QObject):
|
|||||||
self._flags |= QWebPage.FindCaseSensitively
|
self._flags |= QWebPage.FindCaseSensitively
|
||||||
if config.get('general', 'wrap-search'):
|
if config.get('general', 'wrap-search'):
|
||||||
self._flags |= QWebPage.FindWrapsAroundDocument
|
self._flags |= QWebPage.FindWrapsAroundDocument
|
||||||
if rev:
|
if reverse:
|
||||||
self._flags |= QWebPage.FindBackward
|
self._flags |= QWebPage.FindBackward
|
||||||
# We actually search *twice* - once to highlight everything, then again
|
# We actually search *twice* - once to highlight everything, then again
|
||||||
# to get a mark so we can navigate.
|
# to get a mark so we can navigate.
|
||||||
@ -100,15 +102,6 @@ class SearchRunner(QObject):
|
|||||||
self.do_search.emit(self._text, self._flags |
|
self.do_search.emit(self._text, self._flags |
|
||||||
QWebPage.HighlightAllOccurrences)
|
QWebPage.HighlightAllOccurrences)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
|
||||||
def search(self, text):
|
|
||||||
"""Search for a text on a website.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
text: The text to search for.
|
|
||||||
"""
|
|
||||||
self._search(text)
|
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def search_rev(self, text):
|
def search_rev(self, text):
|
||||||
"""Search for a text on a website in reverse direction.
|
"""Search for a text on a website in reverse direction.
|
||||||
@ -116,7 +109,7 @@ class SearchRunner(QObject):
|
|||||||
Args:
|
Args:
|
||||||
text: The text to search for.
|
text: The text to search for.
|
||||||
"""
|
"""
|
||||||
self._search(text, rev=True)
|
self.search(text, reverse=True)
|
||||||
|
|
||||||
@cmdutils.register(instance='search-runner', hide=True, scope='window')
|
@cmdutils.register(instance='search-runner', hide=True, scope='window')
|
||||||
def search_next(self, count: {'special': 'count'}=1):
|
def search_next(self, count: {'special': 'count'}=1):
|
||||||
|
Loading…
Reference in New Issue
Block a user