Keep current commit highlighted in left pane
This commit is contained in:
parent
01d24e0733
commit
7f150109bd
|
|
@ -36,24 +36,24 @@ def main(stdscr, filename):
|
|||
scroll_offset = min(scroll_offset, max_scroll)
|
||||
visible_lines = file_lines[scroll_offset:scroll_offset + height - 1]
|
||||
|
||||
# Draw commit list
|
||||
# Draw commit list (left pane)
|
||||
for i in range(min(len(commits), height - 1)):
|
||||
line = commits[i]
|
||||
if i == selected_commit and focus == "left":
|
||||
stdscr.attron(curses.A_REVERSE)
|
||||
if i == selected_commit:
|
||||
stdscr.attron(curses.A_REVERSE) # Highlight selected commit
|
||||
stdscr.addnstr(i, 0, line, divider_col - 1)
|
||||
if i == selected_commit and focus == "left":
|
||||
if i == selected_commit:
|
||||
stdscr.attroff(curses.A_REVERSE)
|
||||
|
||||
# Vertical divider
|
||||
for y in range(height):
|
||||
stdscr.addch(y, divider_col, '│')
|
||||
|
||||
# File content
|
||||
# Draw file content (right pane)
|
||||
for i, line in enumerate(visible_lines):
|
||||
stdscr.addnstr(i, divider_col + 2, line, width - divider_col - 3)
|
||||
|
||||
# Status bar for right pane
|
||||
# Status bar for right pane (line N/M)
|
||||
status = f"line {scroll_offset + 1}/{len(file_lines)}"
|
||||
stdscr.addnstr(height - 1, divider_col + 2, status, width - divider_col - 3, curses.A_DIM)
|
||||
|
||||
|
|
@ -91,9 +91,9 @@ def main(stdscr, filename):
|
|||
elif key in [curses.KEY_UP, ord('k')]:
|
||||
if scroll_offset > 0:
|
||||
scroll_offset -= 1
|
||||
elif key == curses.KEY_NPAGE: # Page Down
|
||||
elif key in [curses.KEY_NPAGE, ord(' ')]:
|
||||
scroll_offset = min(scroll_offset + height - 1, max_scroll)
|
||||
elif key == curses.KEY_PPAGE: # Page Up
|
||||
elif key in [curses.KEY_PPAGE, 8, 127]: # Page Up or Shift+Space (some terminals)
|
||||
scroll_offset = max(0, scroll_offset - (height - 1))
|
||||
|
||||
# Pane switching
|
||||
|
|
|
|||
Loading…
Reference in New Issue