diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 337552598..461dba577 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -294,12 +294,15 @@ class MainWindow(QWidget): # commands keyparsers[usertypes.KeyMode.normal].keystring_updated.connect( status.keystring.setText) - keyparsers[usertypes.KeyMode.normal].keystring_updated.connect( - self._keyhint.update_keyhint) cmd.got_cmd.connect(self._commandrunner.run_safely) cmd.returnPressed.connect(tabs.on_cmd_return_pressed) 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 for obj in keyparsers.values(): key_config.changed.connect(obj.on_keyconfig_changed) diff --git a/qutebrowser/misc/keyhintwidget.py b/qutebrowser/misc/keyhintwidget.py index 7274f3f68..4b1bde199 100644 --- a/qutebrowser/misc/keyhintwidget.py +++ b/qutebrowser/misc/keyhintwidget.py @@ -80,7 +80,7 @@ class KeyHintView(QLabel): super().showEvent(e) @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). Args: @@ -95,7 +95,7 @@ class KeyHintView(QLabel): text = '' keyconf = objreg.get('key-config') # 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): suffix = "{}".format(self._suffix_color, key[len(prefix):])