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:
8
main.py
8
main.py
@@ -43,17 +43,15 @@ def main_loop(stdscr):
|
|||||||
logging.info('Starting main loop...')
|
logging.info('Starting main loop...')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
current_screen_instance = screens[state.current_screen]
|
|
||||||
|
|
||||||
# Rate limit key presses unless in a text input field
|
# 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)
|
time.sleep(0.05)
|
||||||
else:
|
else:
|
||||||
c = stdscr.getch()
|
c = stdscr.getch()
|
||||||
if c != curses.ERR:
|
if c != curses.ERR:
|
||||||
state.c = c
|
state.c = c
|
||||||
state.last_key_time = time.time()
|
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:
|
if state.current_screen != state.prev_screen:
|
||||||
logging.info('Switching to screen: %s', state.current_screen)
|
logging.info('Switching to screen: %s', state.current_screen)
|
||||||
@@ -67,7 +65,7 @@ def main_loop(stdscr):
|
|||||||
|
|
||||||
state.prev_screen = state.current_screen
|
state.prev_screen = state.current_screen
|
||||||
|
|
||||||
current_screen_instance.draw()
|
screens[state.current_screen].draw()
|
||||||
stdscr.move(23, 79)
|
stdscr.move(23, 79)
|
||||||
stdscr.refresh()
|
stdscr.refresh()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user