diff options
Diffstat (limited to 'src/windows')
-rw-r--r-- | src/windows/input_placeholders.py | 13 | ||||
-rw-r--r-- | src/windows/inputs.py | 12 |
2 files changed, 15 insertions, 10 deletions
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 diff --git a/src/windows/inputs.py b/src/windows/inputs.py index ff13a562..afce3dd8 100644 --- a/src/windows/inputs.py +++ b/src/windows/inputs.py @@ -8,6 +8,7 @@ log = logging.getLogger(__name__) import curses import string +import keyboard import common import poopt from . import Win @@ -655,11 +656,12 @@ class MessageInput(HistoryInput): """ Read one more char (c), add the corresponding char from formats_char to the text string """ - attr_char = self.core.read_keyboard()[0] - if attr_char in self.text_attributes: - char = format_chars[self.text_attributes.index(attr_char)] - self.do_command(char, False) - self.rewrite_text() + def cb(attr_char): + if attr_char in self.text_attributes: + char = format_chars[self.text_attributes.index(attr_char)] + self.do_command(char, False) + self.rewrite_text() + keyboard.continuation_keys_callback = cb def key_enter(self): if self.history_enter(): |