From d8225a768686a88f2bdaabae6d2a57c541ac7f77 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 14 Oct 2025 02:08:13 -0500 Subject: [PATCH] support multiple characters added add cursor position --- system/ui/widgets/inputbox.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system/ui/widgets/inputbox.py b/system/ui/widgets/inputbox.py index f53e3f0ebb..e1054b9ed2 100644 --- a/system/ui/widgets/inputbox.py +++ b/system/ui/widgets/inputbox.py @@ -74,11 +74,11 @@ class InputBox(Widget): elif cursor_x > self._text_offset + visible_width: self._text_offset = cursor_x - visible_width + padding - def add_char_at_cursor(self, char): - """Add a character at the current cursor position.""" + def add_text_at_cursor(self, text): + """Add text at the current cursor position.""" if len(self._input_text) < self._max_text_size: - self._input_text = self._input_text[: self._cursor_position] + char + self._input_text[self._cursor_position:] - self.set_cursor_position(self._cursor_position + 1) + self._input_text = self._input_text[: self._cursor_position] + text + self._input_text[self._cursor_position:] + self.set_cursor_position(self._cursor_position + len(text)) if self._password_mode: self._last_char_time = time.monotonic() @@ -209,7 +209,7 @@ class InputBox(Widget): # Handle text input char = rl.get_char_pressed() if char != 0 and char >= 32: # Filter out control characters - self.add_char_at_cursor(chr(char)) + self.add_text_at_cursor(chr(char)) def _process_key(self, key): if key == rl.KEY_LEFT: