Resolve issues with leader mode, allow single-key targets (HID or internal)

This commit is contained in:
Josh Klar
2018-12-29 16:52:06 -08:00
parent ea63c888d6
commit 0878538f42
3 changed files with 18 additions and 2 deletions

View File

@@ -219,11 +219,20 @@ class InternalState:
def _handle_leader_sequence(self):
lmh = tuple(self.leader_mode_history)
# Will get caught in infinite processing loops if we don't
# exit leader mode before processing the target key
self._exit_leader_mode()
if lmh in self.config.leader_dictionary:
# Stack depth exceeded if try to use add_key here with a unicode sequence
self.process_key(self.config.leader_dictionary[lmh], True)
return self._exit_leader_mode()
self.set_timeout(
False,
lambda: self.remove_key(self.config.leader_dictionary[lmh]),
)
return self
def _process_leader_mode(self):
keys_pressed = self.keys_pressed