Save the filter string in HintManager
This allows restoring the filter during rapid hinting in numeric mode (addresses #576)
This commit is contained in:
parent
335c6783ce
commit
9d20280573
@ -117,6 +117,7 @@ class HintManager(QObject):
|
|||||||
_context: The HintContext for the current invocation.
|
_context: The HintContext for the current invocation.
|
||||||
_win_id: The window ID this HintManager is associated with.
|
_win_id: The window ID this HintManager is associated with.
|
||||||
_tab_id: The tab 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:
|
Signals:
|
||||||
mouse_event: Mouse event to be posted in the web view.
|
mouse_event: Mouse event to be posted in the web view.
|
||||||
@ -866,8 +867,16 @@ class HintManager(QObject):
|
|||||||
"""Filter displayed hints according to a text.
|
"""Filter displayed hints according to a text.
|
||||||
|
|
||||||
Args:
|
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():
|
for elems in self._context.elems.values():
|
||||||
try:
|
try:
|
||||||
if (filterstr is None or
|
if (filterstr is None or
|
||||||
@ -955,7 +964,7 @@ class HintManager(QObject):
|
|||||||
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
|
modeman.maybe_leave(self._win_id, usertypes.KeyMode.hint,
|
||||||
'followed')
|
'followed')
|
||||||
else:
|
else:
|
||||||
# Show all hints again
|
# Reset filtering
|
||||||
self.filter_hints(None)
|
self.filter_hints(None)
|
||||||
# Undo keystring highlighting
|
# Undo keystring highlighting
|
||||||
for (text, elems) in self._context.elems.items():
|
for (text, elems) in self._context.elems.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user