refactor: Use A_REVERSE for consistent status bar highlighting

This commit is contained in:
n loewen (aider) 2025-06-08 00:25:06 +01:00
parent 4e444f4a14
commit 8bae7e1cfe
1 changed files with 6 additions and 6 deletions

12
gtm2.py
View File

@ -377,8 +377,8 @@ def draw_status_bars(stdscr, state):
left_percent = 0 left_percent = 0
left_status = f"{left_percent}%" left_status = f"{left_percent}%"
# Use reverse video (like selected sidebar entry) for the status bar # Use terminal's default colors for the status bar
status_attr = curses.color_pair(1) # black on white (same as selected entry) status_attr = curses.A_NORMAL # Use terminal's default colors
# Fill the status bar with spaces # Fill the status bar with spaces
for x in range(state.width - 1): for x in range(state.width - 1):
@ -390,8 +390,8 @@ def draw_status_bars(stdscr, state):
# Add left percentage indicator (only if sidebar is visible) # Add left percentage indicator (only if sidebar is visible)
if state.show_sidebar: if state.show_sidebar:
try: try:
# Use normal video if left pane is not active # Use reverse video if left pane is active
left_attr = status_attr if state.focus == "left" else status_attr | curses.A_REVERSE left_attr = curses.A_REVERSE if state.focus == "left" else status_attr
# Add a space before and after the percentage with the same highlighting # Add a space before and after the percentage with the same highlighting
stdscr.addstr(state.height - 1, 0, f" {left_status} ", left_attr) stdscr.addstr(state.height - 1, 0, f" {left_status} ", left_attr)
except curses.error: except curses.error:
@ -422,8 +422,8 @@ def draw_status_bars(stdscr, state):
padded_right_status = f" {right_status} " padded_right_status = f" {right_status} "
right_x = state.width - len(padded_right_status) right_x = state.width - len(padded_right_status)
if right_x >= 0: if right_x >= 0:
# Use normal video if right pane is active, reverse if not # Use reverse video if right pane is active
right_attr = status_attr if state.focus == "right" else status_attr | curses.A_REVERSE right_attr = curses.A_REVERSE if state.focus == "right" else status_attr
stdscr.addstr(state.height - 1, right_x, padded_right_status, right_attr) stdscr.addstr(state.height - 1, right_x, padded_right_status, right_attr)
except curses.error: except curses.error:
pass pass