fix: Resolve terminal color initialization crash by using safe color pair

This commit is contained in:
n loewen (aider) 2025-06-07 23:25:22 +01:00
parent 6aa6881f0b
commit 68e65cd851
1 changed files with 2 additions and 1 deletions

View File

@ -552,7 +552,8 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse):
if curses.has_colors():
curses.use_default_colors()
curses.init_pair(1, 5, 7)
curses.init_pair(2, curses.COLOR_WHITE, 8)
# Use a safe background color (7 or less) to avoid "Color number is greater than COLORS-1" error
curses.init_pair(2, curses.COLOR_WHITE, 0) # Use black (0) instead of 8
curses.init_pair(3, curses.COLOR_GREEN, -1)
curses.init_pair(4, curses.COLOR_RED, -1)