Support esc to abort hinting
This commit is contained in:
parent
de0e96ab2d
commit
ee8ba55676
@ -242,6 +242,8 @@ class QuteBrowser(QApplication):
|
||||
self.mainwindow.status.keystring.setText)
|
||||
self._keyparsers["hint"].fire_hint.connect(
|
||||
self.mainwindow.tabs.cur.fire_hint)
|
||||
self._keyparsers["hint"].abort_hinting.connect(
|
||||
self.mainwindow.tabs.cur.abort_hinting)
|
||||
self._keyparsers["hint"].keystring_updated.connect(
|
||||
self.mainwindow.tabs.cur.handle_hint_key)
|
||||
self.mainwindow.tabs.hint_strings_updated.connect(
|
||||
|
@ -185,6 +185,11 @@ class CurCommandDispatcher(QObject):
|
||||
"""Fire a completed hint."""
|
||||
self._tabs.currentWidget().hintmanager.fire(keystr)
|
||||
|
||||
@pyqtSlot()
|
||||
def abort_hinting(self):
|
||||
"""Abort hinting."""
|
||||
self._tabs.currentWidget().hintmanager.stop()
|
||||
|
||||
@pyqtSlot(str, int)
|
||||
def search(self, text, flags):
|
||||
"""Search for text in the current page.
|
||||
|
@ -41,10 +41,20 @@ class HintKeyParser(KeyParser):
|
||||
Signals:
|
||||
fire_hint: When a hint keybinding was completed.
|
||||
Arg: the keystring/hint string pressed.
|
||||
abort_hinting: Esc pressed, so abort hinting.
|
||||
"""
|
||||
|
||||
supports_count = False
|
||||
fire_hint = pyqtSignal(str)
|
||||
abort_hinting = pyqtSignal()
|
||||
|
||||
def _handle_modifier_key(self, e):
|
||||
"""We don't support modifiers here, but we'll handle escape in here."""
|
||||
if e.key() == Qt.Key_Escape:
|
||||
self._keystring = ''
|
||||
self.abort_hinting.emit()
|
||||
return True
|
||||
return False
|
||||
|
||||
def execute(self, cmdstr, count=None):
|
||||
"""Handle a completed keychain."""
|
||||
|
Loading…
Reference in New Issue
Block a user