diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 6748da9aa..487a2ee3a 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -40,7 +40,7 @@ from qutebrowser.commands import userscripts, runners, cmdutils from qutebrowser.config import (style, config, websettings, iniparsers, lineparser, configtypes, keyconfparser) from qutebrowser.network import qutescheme, proxy -from qutebrowser.browser import quickmarks, cookies, downloads, cache +from qutebrowser.browser import quickmarks, cookies, downloads, cache, hints from qutebrowser.widgets import mainwindow, console, crash from qutebrowser.keyinput import modeparsers, keyparser, modeman from qutebrowser.utils import (log, version, message, utilcmds, readline, @@ -387,6 +387,7 @@ class Application(QApplication): # misc self.lastWindowClosed.connect(self.shutdown) tabs.quit.connect(self.shutdown) + mode_manager.entered.connect(hints.on_mode_entered) # status bar mode_manager.entered.connect(status.on_mode_entered) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 5e841134b..7dbea5943 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -42,6 +42,13 @@ Target = usertypes.enum('Target', 'normal', 'tab', 'tab_bg', 'yank', 'userscript', 'spawn') +@pyqtSlot(usertypes.KeyMode) +def on_mode_entered(mode): + """Stop hinting when insert mode was entered.""" + if mode == usertypes.KeyMode.insert: + modeman.maybe_leave(usertypes.KeyMode.hint, 'insert mode') + + class HintContext: """Context namespace used for hinting. @@ -139,7 +146,6 @@ class HintManager(QObject): super().__init__(parent) self._context = None objreg.get('mode-manager').left.connect(self.on_mode_left) - objreg.get('mode-manager').entered.connect(self.on_mode_entered) def _cleanup(self): """Clean up after hinting.""" @@ -676,12 +682,6 @@ class HintManager(QObject): css = self._get_hint_css(elems.elem, elems.label) elems.label['style'] = css - @pyqtSlot(usertypes.KeyMode) - def on_mode_entered(self, mode): - """Stop hinting when insert mode was entered.""" - if mode == usertypes.KeyMode.insert: - modeman.maybe_leave(usertypes.KeyMode.hint, 'insert mode') - @pyqtSlot(usertypes.KeyMode) def on_mode_left(self, mode): """Stop hinting when hinting mode was left."""