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...') logging.info('Starting main loop...')
while True: while True:
# Rate limit key presses unless in a text input field c = stdscr.getch()
if not screens[state.current_screen].is_typing and time.time() < state.last_key_time + 1: if c != curses.ERR:
time.sleep(0.05) # Rate limit key presses unless in a text input field
else: if not screens[state.current_screen].is_typing and time.time() < state.last_key_time + 1:
c = stdscr.getch() pass # Key press ignored due to rate limit
if c != curses.ERR: else:
state.c = c state.c = c
state.last_key_time = time.time() state.last_key_time = time.time()
screens[state.current_screen].handle_input(c) screens[state.current_screen].handle_input(c)