Skip to content

Commit 400a8d2

Browse files
author
Jonathan Plasse
committed
Fix replace logic
1 parent b042f75 commit 400a8d2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/textual/widgets/_masked_input.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ def replace(self, text: str, start: int, end: int):
631631
self.cursor_position = start
632632
new_value = self._template.insert_text_at_cursor(text)
633633
if new_value is not None:
634-
self.value, self.cursor_position = new_value
634+
value, cursor_position = new_value
635+
self.value = value[:cursor_position] + value[end:]
636+
self.cursor_position = cursor_position
635637
else:
636638
self.cursor_position = old_cursor_position
637639
self.restricted()

0 commit comments

Comments
 (0)