Perhaps fix it more properly after all :-)

This commit is contained in:
Martin Tournoij 2015-06-05 15:10:41 +02:00
parent 57ddd8e95e
commit fa65f345ac
4 changed files with 17 additions and 9 deletions

View File

@ -685,6 +685,7 @@ How many steps to zoom out.
[options="header",width="75%",cols="25%,75%"]
|==============
|Command|Description
|<<clear-keychain,clear-keychain>>|Clear the currently entered key chain.
|<<command-accept,command-accept>>|Execute the command currently in the commandline.
|<<command-history-next,command-history-next>>|Go forward in the commandline history.
|<<command-history-prev,command-history-prev>>|Go back in the commandline history.
@ -739,6 +740,10 @@ How many steps to zoom out.
|<<toggle-selection,toggle-selection>>|Toggle caret selection mode.
|<<yank-selected,yank-selected>>|Yank the selected text to the clipboard or primary selection.
|==============
[[clear-keychain]]
=== clear-keychain
Clear the currently entered key chain.
[[command-accept]]
=== command-accept
Execute the command currently in the commandline.

View File

@ -1143,7 +1143,7 @@ KEY_DATA = collections.OrderedDict([
])),
('normal', collections.OrderedDict([
('search', ['<Escape>']),
('search ;; clear-keychain', ['<Escape>']),
('set-cmd-text -s :open', ['o']),
('set-cmd-text :open {url}', ['go']),
('set-cmd-text -s :open -t', ['O']),

View File

@ -298,14 +298,6 @@ class BaseKeyParser(QObject):
"""
handled = self._handle_special_key(e)
# Special case for <Esc>. See:
# https://github.com/The-Compiler/qutebrowser/issues/716
if e.key() == Qt.Key_Escape:
self._debug_log("Escape pressed, discarding '{}'.".format(
self._keystring))
self._keystring = ''
self.keystring_updated.emit(self._keystring)
if handled or not self._supports_chains:
return handled
match = self._handle_single_key(e)
@ -362,3 +354,9 @@ class BaseKeyParser(QObject):
"defined!")
if mode == self._modename:
self.read_config()
def clear_keystring(self):
"""Clear the currently entered key sequence."""
self._debug_log("discarding keystring '{}'.".format(self._keystring))
self._keystring = ''
self.keystring_updated.emit(self._keystring)

View File

@ -332,3 +332,8 @@ class ModeManager(QObject):
return self._eventFilter_keypress(event)
else:
return self._eventFilter_keyrelease(event)
@cmdutils.register(instance='mode-manager', scope='window', hide=True)
def clear_keychain(self):
"""Clear the currently entered key chain."""
self._handlers[self.mode].__self__.clear_keystring()