Add search-prev and bind N to it
This commit is contained in:
parent
da2dc4861f
commit
d450257485
1
TODO
1
TODO
@ -61,7 +61,6 @@ Improvements / minor features
|
||||
- Zoom with ctrl + mousewheel
|
||||
- Close tabs on right click
|
||||
- Up/Down not for history
|
||||
- N for prev search match
|
||||
- search highlighting
|
||||
- readline like shortcuts (like C-w) for command prompt
|
||||
- max height for completion (be smaller if possible)
|
||||
|
@ -129,6 +129,29 @@ class SearchManager(QObject):
|
||||
for _ in range(count):
|
||||
self.do_search.emit(self._text, self._flags)
|
||||
|
||||
@cmdutils.register(instance='searchmanager', hide=True)
|
||||
def search_prev(self, count=1):
|
||||
"""Continue the search to the ([count]th) previous term.
|
||||
|
||||
Args:
|
||||
count: How many elements to ignore.
|
||||
|
||||
Emit:
|
||||
do_search: If a search should be started.
|
||||
"""
|
||||
if self._text is None:
|
||||
return
|
||||
# The int() here serves as a QFlags constructor to create a copy of the
|
||||
# QFlags instance rather as a reference. I don't know why it works this
|
||||
# way, but it does.
|
||||
flags = int(self._flags)
|
||||
if flags & QWebPage.FindBackward:
|
||||
flags &= ~QWebPage.FindBackward
|
||||
else:
|
||||
flags |= QWebPage.FindBackward
|
||||
for _ in range(count):
|
||||
self.do_search.emit(self._text, flags)
|
||||
|
||||
|
||||
class CommandManager:
|
||||
|
||||
|
@ -619,6 +619,7 @@ DATA = OrderedDict([
|
||||
('gg', 'scroll-perc-y 0'),
|
||||
('G', 'scroll-perc-y'),
|
||||
('n', 'search-next'),
|
||||
('N', 'search-prev'),
|
||||
('i', 'enter-mode insert'),
|
||||
('yy', 'yank'),
|
||||
('yY', 'yank sel'),
|
||||
|
Loading…
Reference in New Issue
Block a user