From 48a302045f00cac01a746a342aba14054b758b2a Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Thu, 16 Oct 2025 09:07:27 +0200 Subject: [PATCH] Fix terminal ctrl+s issue --- owocr/run.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/owocr/run.py b/owocr/run.py index 6e3a943..ed6125e 100644 --- a/owocr/run.py +++ b/owocr/run.py @@ -1435,16 +1435,21 @@ def user_input_thread_run(): else: time.sleep(0.2) else: - import tty, termios, select + import termios, select fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) + new_settings = termios.tcgetattr(fd) + new_settings[0] &= ~termios.IXON + new_settings[3] &= ~(termios.ICANON | termios.ECHO) + new_settings[6][termios.VMIN] = 1 + new_settings[6][termios.VTIME] = 0 try: - tty.setcbreak(fd) + termios.tcsetattr(fd, termios.TCSANOW, new_settings) while not terminated.is_set(): if coordinate_selector_event.is_set(): while coordinate_selector_event.is_set(): time.sleep(0.1) - tty.setcbreak(fd) + termios.tcsetattr(fd, termios.TCSANOW, new_settings) rlist, _, _ = select.select([sys.stdin], [], [], 0.2) if rlist: user_input = sys.stdin.read(1)