Fix curses error when info window is full
- Wrap addstr newlines in try/except blocks - Prevents crash when writing to window boundary - Info window has scrollok=False, so cursor can't move beyond bounds
This commit is contained in:
9
ui.py
9
ui.py
@ -653,7 +653,10 @@ class UIManager:
|
||||
f"{limit_display}^0\n", 0)
|
||||
|
||||
# Blank lines to fill
|
||||
try:
|
||||
self.info_window.addstr("\n")
|
||||
except curses.error:
|
||||
pass
|
||||
|
||||
# Line 3: Team headers and player lists
|
||||
teams = game_state.player_tracker.get_players_by_team()
|
||||
@ -768,7 +771,10 @@ class UIManager:
|
||||
print_colored(self.info_window, line, 0)
|
||||
|
||||
# Blank lines to fill
|
||||
try:
|
||||
self.info_window.addstr("\n")
|
||||
except curses.error:
|
||||
pass
|
||||
|
||||
# List spectators on one line
|
||||
spec_list = " ".join(spec_players)
|
||||
@ -776,7 +782,10 @@ class UIManager:
|
||||
print_colored(self.info_window, line, 0)
|
||||
|
||||
# Blank lines to fill
|
||||
try:
|
||||
self.info_window.addstr("\n")
|
||||
except curses.error:
|
||||
pass
|
||||
|
||||
# Separator
|
||||
separator = "^7" + "═" * (max_x - 1) + "^7"
|
||||
|
||||
Reference in New Issue
Block a user