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:
15
ui.py
15
ui.py
@ -653,7 +653,10 @@ class UIManager:
|
|||||||
f"{limit_display}^0\n", 0)
|
f"{limit_display}^0\n", 0)
|
||||||
|
|
||||||
# Blank lines to fill
|
# Blank lines to fill
|
||||||
self.info_window.addstr("\n")
|
try:
|
||||||
|
self.info_window.addstr("\n")
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
|
|
||||||
# Line 3: Team headers and player lists
|
# Line 3: Team headers and player lists
|
||||||
teams = game_state.player_tracker.get_players_by_team()
|
teams = game_state.player_tracker.get_players_by_team()
|
||||||
@ -768,7 +771,10 @@ class UIManager:
|
|||||||
print_colored(self.info_window, line, 0)
|
print_colored(self.info_window, line, 0)
|
||||||
|
|
||||||
# Blank lines to fill
|
# Blank lines to fill
|
||||||
self.info_window.addstr("\n")
|
try:
|
||||||
|
self.info_window.addstr("\n")
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
|
|
||||||
# List spectators on one line
|
# List spectators on one line
|
||||||
spec_list = " ".join(spec_players)
|
spec_list = " ".join(spec_players)
|
||||||
@ -776,7 +782,10 @@ class UIManager:
|
|||||||
print_colored(self.info_window, line, 0)
|
print_colored(self.info_window, line, 0)
|
||||||
|
|
||||||
# Blank lines to fill
|
# Blank lines to fill
|
||||||
self.info_window.addstr("\n")
|
try:
|
||||||
|
self.info_window.addstr("\n")
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
|
|
||||||
# Separator
|
# Separator
|
||||||
separator = "^7" + "═" * (max_x - 1) + "^7"
|
separator = "^7" + "═" * (max_x - 1) + "^7"
|
||||||
|
|||||||
Reference in New Issue
Block a user