From 850a56a2ff78cff6dfff366c029ee65b373a4fdf Mon Sep 17 00:00:00 2001 From: n loewen Date: Sun, 8 Jun 2025 08:38:07 +0100 Subject: [PATCH] refactor: Simplify color pair initialization and remove unused color pairs --- gtm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gtm b/gtm index e7223c9..1b854a8 100755 --- a/gtm +++ b/gtm @@ -683,7 +683,7 @@ def draw_help_popup(stdscr, state): # Calculate popup dimensions and position popup_width = 60 # Calculate height based on number of help items plus margins - popup_height = len(help_items) + 5 # 5 extra lines for borders, title, and footer + popup_height = len(help_items) + 4 # 4 extra lines for borders, title, and footer popup_x = max(0, (state.width - popup_width) // 2) popup_y = max(0, (state.height - popup_height) // 2) @@ -1193,14 +1193,11 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse, wrap_lines=True if curses.has_colors(): curses.use_default_colors() # Use a safe background color (7 or less) to avoid "Color number is greater than COLORS-1" error - curses.init_pair(1, curses.COLOR_BLACK, 7) # Active pane: black on white - curses.init_pair(2, curses.COLOR_WHITE, 0) # Inactive pane: white on black curses.init_pair(3, curses.COLOR_GREEN, -1) # Added lines curses.init_pair(4, curses.COLOR_RED, -1) # Deleted lines curses.init_pair(5, curses.COLOR_GREEN, -1) # Line numbers for added lines curses.init_pair(6, curses.COLOR_RED, -1) # Line numbers for deleted lines - curses.init_pair(7, curses.COLOR_BLUE, -1) # Regular line numbers - curses.init_pair(8, curses.COLOR_BLACK, curses.COLOR_YELLOW) # Search matches + curses.init_pair(7, 7, -1) # Regular line numbers height, width = stdscr.getmaxyx() # If show_diff is true, enable both additions and deletions