From ca2d0d34bde656ec20ffdfd88952853d701cf946 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 10 Jul 2025 01:22:24 -0400 Subject: [PATCH] A few more tweaks to the input code. --- input.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/input.py b/input.py index e15fffa..0a3e392 100644 --- a/input.py +++ b/input.py @@ -21,6 +21,7 @@ def get_input(prompt="Enter text:", text=""): - Up/Down arrows read full text content - Backspace announces deletions - Enter submits, Escape cancels + - Control key repeats the original prompt message - Fully accessible without screen reader dependency Args: @@ -37,18 +38,10 @@ def get_input(prompt="Enter text:", text=""): # Announce the prompt and initial text as a single message if text: - message = f"{prompt} Default text: {text}" + initial_message = f"{prompt} Default text: {text}" else: - message = f"{prompt} Empty text field" - speak(message) - - # Speak initial cursor position - if cursor_pos == 0: - speak("Beginning of text") - elif cursor_pos == len(text_buffer): - speak("End of text") - else: - speak(f"At character: {text_buffer[cursor_pos]}") + initial_message = f"{prompt} Empty text field" + speak(initial_message) # Main input loop while True: @@ -121,6 +114,10 @@ def get_input(prompt="Enter text:", text=""): cursor_pos = len(text_buffer) speak("End of text") + elif event.key == pygame.K_LCTRL or event.key == pygame.K_RCTRL: + # Repeat the original prompt message + speak(initial_message) + else: # Handle regular character input if event.unicode and event.unicode.isprintable():