fix: Directly access current screen instance for operations

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

View File

@@ -43,17 +43,15 @@ def main_loop(stdscr):
logging.info('Starting main loop...')
while True:
current_screen_instance = screens[state.current_screen]
# Rate limit key presses unless in a text input field
if not current_screen_instance.is_typing and time.time() < state.last_key_time + 1:
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:
state.c = c
state.last_key_time = time.time()
current_screen_instance.handle_input(c)
screens[state.current_screen].handle_input(c)
if state.current_screen != state.prev_screen:
logging.info('Switching to screen: %s', state.current_screen)
@@ -67,7 +65,7 @@ def main_loop(stdscr):
state.prev_screen = state.current_screen
current_screen_instance.draw()
screens[state.current_screen].draw()
stdscr.move(23, 79)
stdscr.refresh()