refactor: Simplify color pair initialization and remove unused color pairs
This commit is contained in:
parent
26a10c5dbc
commit
850a56a2ff
7
gtm
7
gtm
|
|
@ -683,7 +683,7 @@ def draw_help_popup(stdscr, state):
|
||||||
# Calculate popup dimensions and position
|
# Calculate popup dimensions and position
|
||||||
popup_width = 60
|
popup_width = 60
|
||||||
# Calculate height based on number of help items plus margins
|
# 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_x = max(0, (state.width - popup_width) // 2)
|
||||||
popup_y = max(0, (state.height - popup_height) // 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():
|
if curses.has_colors():
|
||||||
curses.use_default_colors()
|
curses.use_default_colors()
|
||||||
# Use a safe background color (7 or less) to avoid "Color number is greater than COLORS-1" error
|
# 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(3, curses.COLOR_GREEN, -1) # Added lines
|
||||||
curses.init_pair(4, curses.COLOR_RED, -1) # Deleted 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(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(6, curses.COLOR_RED, -1) # Line numbers for deleted lines
|
||||||
curses.init_pair(7, curses.COLOR_BLUE, -1) # Regular line numbers
|
curses.init_pair(7, 7, -1) # Regular line numbers
|
||||||
curses.init_pair(8, curses.COLOR_BLACK, curses.COLOR_YELLOW) # Search matches
|
|
||||||
|
|
||||||
height, width = stdscr.getmaxyx()
|
height, width = stdscr.getmaxyx()
|
||||||
# If show_diff is true, enable both additions and deletions
|
# If show_diff is true, enable both additions and deletions
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue