Always handle the <Esc> key, even if it's bound.

This fixes #716, which sufficiently annoyed me to make this quick fix. It's not
a great fix, but it's not worse than what we had already, and the current
behaviour is very surprising IMHO.
This commit is contained in:
Martin Tournoij 2015-06-05 14:24:43 +02:00
parent 728f06e797
commit 57ddd8e95e

View File

@ -162,12 +162,6 @@ class BaseKeyParser(QObject):
key = e.key() key = e.key()
self._debug_log("Got key: 0x{:x} / text: '{}'".format(key, txt)) self._debug_log("Got key: 0x{:x} / text: '{}'".format(key, txt))
if key == Qt.Key_Escape:
self._debug_log("Escape pressed, discarding '{}'.".format(
self._keystring))
self._keystring = ''
return self.Match.none
if len(txt) == 1: if len(txt) == 1:
category = unicodedata.category(txt) category = unicodedata.category(txt)
is_control_char = (category == 'Cc') is_control_char = (category == 'Cc')
@ -303,6 +297,15 @@ class BaseKeyParser(QObject):
True if the event was handled, False otherwise. True if the event was handled, False otherwise.
""" """
handled = self._handle_special_key(e) 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: if handled or not self._supports_chains:
return handled return handled
match = self._handle_single_key(e) match = self._handle_single_key(e)