Skip to content

Commit

Permalink
Save the filter string in HintManager
Browse files Browse the repository at this point in the history
This allows restoring the filter during rapid hinting in numeric mode (addresses qutebrowser#576)
  • Loading branch information
lahwaacz committed Jan 31, 2016
1 parent f59aafc commit da03afc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions qutebrowser/browser/hints.py
Expand Up @@ -111,6 +111,7 @@ class HintManager(QObject):
_context: The HintContext for the current invocation.
_win_id: The window ID this HintManager is associated with.
_tab_id: The tab ID this HintManager is associated with.
_filterstr: Used to save the filter string for restoring in rapid mode.
Signals:
mouse_event: Mouse event to be posted in the web view.
Expand Down Expand Up @@ -834,8 +835,16 @@ def filter_hints(self, filterstr):
"""Filter displayed hints according to a text.
Args:
filterstr: The string to filter with, or None to show all.
filterstr: The string to filter with, or None to use the filter from
previous call (saved in `self._filterstr`). If `filterstr`
is an empty string or if both `filterstr` and
`self._filterstr` are None, all hints are shown.
"""
if filterstr is None:
filterstr = self._filterstr
else:
self._filterstr = filterstr

for elems in self._context.elems.values():
try:
if (filterstr is None or
Expand Down Expand Up @@ -920,7 +929,7 @@ def fire(self, keystr, force=False):
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
'followed')
else:
# Show all hints again
# Reset filtering
self.filter_hints(None)
# Undo keystring highlighting
for (string, elems) in self._context.elems.items():
Expand Down

0 comments on commit da03afc

Please sign in to comment.