refactor: Remove scrollbar change markers and related code
This commit is contained in:
parent
bbfba3c644
commit
84073402e4
32
gtm
32
gtm
|
|
@ -330,34 +330,6 @@ def jump_to_prev_change(state: AppState) -> AppState:
|
||||||
return replace(state, right_scroll_offset=new_scroll, current_change_idx=prev_idx)
|
return replace(state, right_scroll_offset=new_scroll, current_change_idx=prev_idx)
|
||||||
return state
|
return state
|
||||||
|
|
||||||
def draw_change_markers(stdscr, state):
|
|
||||||
"""Draw markers in the scrollbar area to indicate where changes are located."""
|
|
||||||
if not state.change_blocks or not (state.show_whole_diff or state.show_additions or state.show_deletions):
|
|
||||||
return
|
|
||||||
|
|
||||||
right_start = 0 if not state.show_sidebar else state.divider_col + 2
|
|
||||||
right_width = state.width - right_start - 1
|
|
||||||
marker_col = right_start + right_width - 1
|
|
||||||
|
|
||||||
# Calculate scaling factor for marker positions
|
|
||||||
total_lines = len(state.file_lines)
|
|
||||||
if total_lines <= 1:
|
|
||||||
return
|
|
||||||
|
|
||||||
scale_factor = (state.height - 1) / total_lines
|
|
||||||
|
|
||||||
# Draw markers
|
|
||||||
for i, (start_pos, _) in enumerate(state.change_blocks):
|
|
||||||
marker_y = int(start_pos * scale_factor)
|
|
||||||
if 0 <= marker_y < state.height - 1:
|
|
||||||
# Use a single color for change blocks
|
|
||||||
attr = curses.color_pair(5) # New color pair for change blocks
|
|
||||||
marker_char = '>' if i == state.current_change_idx else '|'
|
|
||||||
|
|
||||||
try:
|
|
||||||
stdscr.addch(marker_y, marker_col, marker_char, attr)
|
|
||||||
except curses.error:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def draw_right_pane(stdscr, state):
|
def draw_right_pane(stdscr, state):
|
||||||
# If sidebar is hidden, right pane starts at column 0
|
# If sidebar is hidden, right pane starts at column 0
|
||||||
|
|
@ -615,9 +587,6 @@ def draw_ui(stdscr, state):
|
||||||
draw_left_pane(stdscr, state)
|
draw_left_pane(stdscr, state)
|
||||||
draw_right_pane(stdscr, state)
|
draw_right_pane(stdscr, state)
|
||||||
draw_divider(stdscr, state)
|
draw_divider(stdscr, state)
|
||||||
# Only draw change markers in the right pane
|
|
||||||
if state.focus == "right":
|
|
||||||
draw_change_markers(stdscr, state)
|
|
||||||
draw_status_bars(stdscr, state)
|
draw_status_bars(stdscr, state)
|
||||||
draw_selection(stdscr, state)
|
draw_selection(stdscr, state)
|
||||||
stdscr.refresh()
|
stdscr.refresh()
|
||||||
|
|
@ -820,7 +789,6 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse, wrap_lines=True
|
||||||
curses.init_pair(2, curses.COLOR_WHITE, 0) # Inactive pane: white on black
|
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_YELLOW, -1) # Change block markers
|
|
||||||
|
|
||||||
height, width = stdscr.getmaxyx()
|
height, width = stdscr.getmaxyx()
|
||||||
state = AppState(
|
state = AppState(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue