Show key hints for all modes, not just normal.

This commit is contained in:
Ryan Roden-Corrent 2016-05-14 06:49:47 -04:00
parent 8406746889
commit e7ff717d52
2 changed files with 7 additions and 4 deletions

View File

@ -294,12 +294,15 @@ class MainWindow(QWidget):
# commands # commands
keyparsers[usertypes.KeyMode.normal].keystring_updated.connect( keyparsers[usertypes.KeyMode.normal].keystring_updated.connect(
status.keystring.setText) status.keystring.setText)
keyparsers[usertypes.KeyMode.normal].keystring_updated.connect(
self._keyhint.update_keyhint)
cmd.got_cmd.connect(self._commandrunner.run_safely) cmd.got_cmd.connect(self._commandrunner.run_safely)
cmd.returnPressed.connect(tabs.on_cmd_return_pressed) cmd.returnPressed.connect(tabs.on_cmd_return_pressed)
tabs.got_cmd.connect(self._commandrunner.run_safely) tabs.got_cmd.connect(self._commandrunner.run_safely)
# key hint popup
for mode, parser in keyparsers.items():
parser.keystring_updated.connect(functools.partial(
self._keyhint.update_keyhint, mode.name))
# config # config
for obj in keyparsers.values(): for obj in keyparsers.values():
key_config.changed.connect(obj.on_keyconfig_changed) key_config.changed.connect(obj.on_keyconfig_changed)

View File

@ -80,7 +80,7 @@ class KeyHintView(QLabel):
super().showEvent(e) super().showEvent(e)
@pyqtSlot(str) @pyqtSlot(str)
def update_keyhint(self, prefix): def update_keyhint(self, modename, prefix):
"""Show hints for the given prefix (or hide if prefix is empty). """Show hints for the given prefix (or hide if prefix is empty).
Args: Args:
@ -95,7 +95,7 @@ class KeyHintView(QLabel):
text = '' text = ''
keyconf = objreg.get('key-config') keyconf = objreg.get('key-config')
# this is only fired in normal mode # this is only fired in normal mode
for key, cmd in keyconf.get_bindings_for('normal').items(): for key, cmd in keyconf.get_bindings_for(modename).items():
if key.startswith(prefix): if key.startswith(prefix):
suffix = "<font color={}>{}</font>".format(self._suffix_color, suffix = "<font color={}>{}</font>".format(self._suffix_color,
key[len(prefix):]) key[len(prefix):])