Cancel register key input with escape

This commit is contained in:
Jan Verbeek 2016-11-11 02:45:59 +01:00
parent d8d7b42c43
commit 75c996c13e
2 changed files with 9 additions and 0 deletions

View File

@ -290,6 +290,10 @@ class RegisterKeyParser(keyparser.BaseKeyParser):
Return:
True if event has been handled, False otherwise.
"""
if e.key() == Qt.Key_Escape:
self.request_leave.emit(self._mode, "register key cancelled", True)
return True
if utils.keyevent_to_string(e) is None:
# this is a modifier key, let it pass and keep going
return False

View File

@ -255,3 +255,8 @@ Feature: Keyboard input
And I press the key "a"
And I wait for "hints: *" in the log
Then no crash should happen
Scenario: Cancelling key input
When I run :record-macro
And I press the key "<Escape>"
Then "Leaving mode KeyMode.record_macro (reason: register key cancelled)" should be logged