Make :follow-hint take a keystring.

This commit is contained in:
Florian Bruhin 2015-11-09 07:35:33 +01:00
parent c1c5b0f2b4
commit 9cfd96fcef
2 changed files with 19 additions and 7 deletions

View File

@ -788,7 +788,7 @@ How many steps to zoom out.
|<<completion-item-prev,completion-item-prev>>|Select the previous completion item.
|<<drop-selection,drop-selection>>|Drop selection and keep selection mode enabled.
|<<enter-mode,enter-mode>>|Enter a key mode.
|<<follow-hint,follow-hint>>|Follow the currently selected hint.
|<<follow-hint,follow-hint>>|Follow a hint.
|<<follow-selected,follow-selected>>|Follow the selected text.
|<<leave-mode,leave-mode>>|Leave the mode we're currently in.
|<<message-error,message-error>>|Show an error message in the statusbar.
@ -877,7 +877,12 @@ Enter a key mode.
[[follow-hint]]
=== follow-hint
Follow the currently selected hint.
Syntax: +:follow-hint ['keystring']+
Follow a hint.
==== positional arguments
* +'keystring'+: The hint to follow.
[[follow-selected]]
=== follow-selected

View File

@ -947,11 +947,18 @@ class HintManager(QObject):
handler()
@cmdutils.register(instance='hintmanager', scope='tab', hide=True)
def follow_hint(self):
"""Follow the currently selected hint."""
if not self._context.to_follow:
raise cmdexc.CommandError("No hint to follow")
self.fire(self._context.to_follow, force=True)
def follow_hint(self, keystring=None):
"""Follow a hint.
Args:
keystring: The hint to follow, or None.
"""
if keystring is None:
if self._context.to_follow is None:
raise cmdexc.CommandError("No hint to follow")
else:
keystring = self._context.to_follow
self.fire(keystring, force=True)
@pyqtSlot('QSize')
def on_contents_size_changed(self, _size):