fix: Prevent key buffering during rate limiting

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-03-04 16:37:38 -07:00
parent 3b1e0c481e
commit fdfefffda6

12
main.py
View File

@@ -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:
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)