Merge branch 'blyxxyz-cancel-register-key'
This commit is contained in:
commit
8268c9c22f
@ -267,7 +267,7 @@ class CaretKeyParser(keyparser.CommandKeyParser):
|
|||||||
self.read_config('caret')
|
self.read_config('caret')
|
||||||
|
|
||||||
|
|
||||||
class RegisterKeyParser(keyparser.BaseKeyParser):
|
class RegisterKeyParser(keyparser.CommandKeyParser):
|
||||||
|
|
||||||
"""KeyParser for modes that record a register key.
|
"""KeyParser for modes that record a register key.
|
||||||
|
|
||||||
@ -280,6 +280,7 @@ class RegisterKeyParser(keyparser.BaseKeyParser):
|
|||||||
super().__init__(win_id, parent, supports_count=False,
|
super().__init__(win_id, parent, supports_count=False,
|
||||||
supports_chains=False)
|
supports_chains=False)
|
||||||
self._mode = mode
|
self._mode = mode
|
||||||
|
self.read_config('register')
|
||||||
|
|
||||||
def handle(self, e):
|
def handle(self, e):
|
||||||
"""Override handle to always match the next key and use the register.
|
"""Override handle to always match the next key and use the register.
|
||||||
@ -290,6 +291,9 @@ class RegisterKeyParser(keyparser.BaseKeyParser):
|
|||||||
Return:
|
Return:
|
||||||
True if event has been handled, False otherwise.
|
True if event has been handled, False otherwise.
|
||||||
"""
|
"""
|
||||||
|
if super().handle(e):
|
||||||
|
return True
|
||||||
|
|
||||||
if utils.keyevent_to_string(e) is None:
|
if utils.keyevent_to_string(e) is None:
|
||||||
# this is a modifier key, let it pass and keep going
|
# this is a modifier key, let it pass and keep going
|
||||||
return False
|
return False
|
||||||
@ -323,7 +327,3 @@ class RegisterKeyParser(keyparser.BaseKeyParser):
|
|||||||
def on_keyconfig_changed(self, mode):
|
def on_keyconfig_changed(self, mode):
|
||||||
"""RegisterKeyParser has no config section (no bindable keys)."""
|
"""RegisterKeyParser has no config section (no bindable keys)."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def execute(self, cmdstr, _keytype, count=None):
|
|
||||||
"""Should never be called on RegisterKeyParser."""
|
|
||||||
assert False
|
|
||||||
|
@ -255,3 +255,8 @@ Feature: Keyboard input
|
|||||||
And I press the key "a"
|
And I press the key "a"
|
||||||
And I wait for "hints: *" in the log
|
And I wait for "hints: *" in the log
|
||||||
Then no crash should happen
|
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: leave current)" should be logged
|
||||||
|
Loading…
Reference in New Issue
Block a user