fix: Prevent key buffering during rate limiting
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
8
main.py
8
main.py
@@ -43,12 +43,12 @@ def main_loop(stdscr):
|
||||
logging.info('Starting main loop...')
|
||||
|
||||
while True:
|
||||
# Rate limit key presses unless in a text input field
|
||||
if not screens[state.current_screen].is_typing and time.time() < state.last_key_time + 1:
|
||||
time.sleep(0.05)
|
||||
else:
|
||||
c = stdscr.getch()
|
||||
if c != curses.ERR:
|
||||
# Rate limit key presses unless in a text input field
|
||||
if not screens[state.current_screen].is_typing and time.time() < state.last_key_time + 1:
|
||||
pass # Key press ignored due to rate limit
|
||||
else:
|
||||
state.c = c
|
||||
state.last_key_time = time.time()
|
||||
screens[state.current_screen].handle_input(c)
|
||||
|
||||
Reference in New Issue
Block a user