style: Modify warning message display to keep text in red

This commit is contained in:
n loewen (aider) 2025-06-08 16:35:10 +01:00
parent 1c03bef555
commit 6b84f1fc2b
1 changed files with 3 additions and 7 deletions

10
gtm
View File

@ -922,14 +922,14 @@ def draw_warning_message(stdscr, state: AppState, layout: StatusBarLayout):
# Use red text with bold for warning # Use red text with bold for warning
warning_attr = curses.color_pair(8) | curses.A_BOLD warning_attr = curses.color_pair(8) | curses.A_BOLD
# Draw the warning message # Draw the warning message and dismiss instruction all in red
warning_text = f" WARNING: {state.warning_message} " warning_text = f" WARNING: {state.warning_message} "
stdscr.addstr(layout.main_status_y, 0, warning_text, warning_attr) stdscr.addstr(layout.main_status_y, 0, warning_text, warning_attr)
# Add instruction to dismiss # Add instruction to dismiss, also in red
dismiss_text = " (Press any key to dismiss) " dismiss_text = " (Press any key to dismiss) "
if len(warning_text) + len(dismiss_text) < layout.screen_width: if len(warning_text) + len(dismiss_text) < layout.screen_width:
stdscr.addstr(layout.main_status_y, len(warning_text), dismiss_text, curses.A_REVERSE) stdscr.addstr(layout.main_status_y, len(warning_text), dismiss_text, warning_attr)
except curses.error: except curses.error:
pass # Silently fail if we can't draw the warning pass # Silently fail if we can't draw the warning
@ -1302,10 +1302,6 @@ def handle_mouse_input(stdscr, state: AppState) -> AppState:
_, mx, my, _, bstate = curses.getmouse() _, mx, my, _, bstate = curses.getmouse()
state = replace(state, last_bstate=bstate, mouse_x=mx, mouse_y=my) state = replace(state, last_bstate=bstate, mouse_x=mx, mouse_y=my)
# If there's a warning message, any mouse click dismisses it
if state.warning_message:
return replace(state, warning_message=None)
# Status bar position # Status bar position
status_bar_start = state.height - state.status_bar_height status_bar_start = state.height - state.status_bar_height