Fix cursor position and live timer updates

- Track cursor position in UIManager.cursor_pos
- Restore cursor after print_message() and update_server_info()
- Sync cursor_pos between wait_stdin thread and manager
- Update server info panel every second for live timer display
- Timer now ticks continuously instead of only on game events
This commit is contained in:
pfl
2026-01-09 14:58:05 +01:00
parent a03b4b0b93
commit fbaa4564e4
2 changed files with 25 additions and 2 deletions
+9
View File
@@ -367,6 +367,9 @@ def main_loop(screen):
# Shutdown flag
shutdown = False
# Timer refresh tracking (update UI once per second)
last_ui_update = 0
# Setup JSON logging if requested
json_logger = None
if args.json_log:
@@ -525,6 +528,12 @@ def main_loop(screen):
formatted_msg, attributes = format_message(message)
ui.print_message(formatted_msg)
# Update server info panel every second (for live timer display)
current_time = time.time()
if current_time - last_ui_update >= 1.0:
ui.update_server_info(game_state)
last_ui_update = current_time
finally:
# Clean up resources
logger.info("Shutting down...")