From 3ef9228211df46ada9bb5b851682a9c7d833de56 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 7 Aug 2014 23:20:21 +0200 Subject: Continuation keys (like after M-j or Ctrl-c) are handled without blocking --- src/windows/input_placeholders.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/windows/input_placeholders.py') diff --git a/src/windows/input_placeholders.py b/src/windows/input_placeholders.py index 6fd7975a..0887cfc5 100644 --- a/src/windows/input_placeholders.py +++ b/src/windows/input_placeholders.py @@ -68,9 +68,12 @@ class YesNoInput(Win): def prompt(self): """Monopolizes the input while waiting for a recognized keypress""" - cl = [] - while self.value is None: - if len(cl) == 1 and cl[0] in self.key_func: - self.key_func[cl[0]]() - cl = self.core.read_keyboard() + def cb(key): + if key in self.key_func: + self.key_func[key]() + if self.value is None: + # We didn’t finish with this prompt, continue monopolizing + # it again until value is set + keyboard.continuation_keys_callback = cb + keyboard.continuation_keys_callback = cb -- cgit v1.2.3