fix: Improve status bar commit message display and resizing
This commit is contained in:
parent
c2c678b8b3
commit
1bf45248bd
12
gtm
12
gtm
|
|
@ -268,6 +268,10 @@ def load_commit_content(state: AppState) -> AppState:
|
||||||
parts = commit_line.split(' ', 3) # Split into hash, date, time, message
|
parts = commit_line.split(' ', 3) # Split into hash, date, time, message
|
||||||
short_message = parts[3] if len(parts) >= 4 else ""
|
short_message = parts[3] if len(parts) >= 4 else ""
|
||||||
|
|
||||||
|
# If commit_details['message'] is empty, use short_message as fallback
|
||||||
|
if not commit_details['message'].strip():
|
||||||
|
commit_details['message'] = short_message
|
||||||
|
|
||||||
max_scroll_new = max(0, len(file_lines) - (state.height - state.status_bar_height))
|
max_scroll_new = max(0, len(file_lines) - (state.height - state.status_bar_height))
|
||||||
right_scroll_offset = state.right_scroll_offset
|
right_scroll_offset = state.right_scroll_offset
|
||||||
if reference_line:
|
if reference_line:
|
||||||
|
|
@ -954,6 +958,8 @@ def draw_status_bars(stdscr, state):
|
||||||
try:
|
try:
|
||||||
# Always draw the commit hash and first line of message on the bottom line
|
# Always draw the commit hash and first line of message on the bottom line
|
||||||
bottom_line = state.height - 1
|
bottom_line = state.height - 1
|
||||||
|
|
||||||
|
# Draw the commit hash with bold
|
||||||
stdscr.addstr(bottom_line, 0, commit_info, curses.A_REVERSE | curses.A_BOLD)
|
stdscr.addstr(bottom_line, 0, commit_info, curses.A_REVERSE | curses.A_BOLD)
|
||||||
|
|
||||||
# Draw the author and branch on the right of the bottom line
|
# Draw the author and branch on the right of the bottom line
|
||||||
|
|
@ -983,7 +989,7 @@ def draw_status_bars(stdscr, state):
|
||||||
# Draw a handle for resizing the status bar
|
# Draw a handle for resizing the status bar
|
||||||
try:
|
try:
|
||||||
handle_char = "≡" if state.dragging_status_bar else "="
|
handle_char = "≡" if state.dragging_status_bar else "="
|
||||||
handle_text = handle_char * 3
|
handle_text = handle_char * 5 # Make handle wider
|
||||||
if state.status_bar_height > 2:
|
if state.status_bar_height > 2:
|
||||||
handle_text += f" ({state.status_bar_height} lines)"
|
handle_text += f" ({state.status_bar_height} lines)"
|
||||||
stdscr.addstr(status_bar_start, state.width // 2 - len(handle_text) // 2, handle_text, curses.A_REVERSE | curses.A_BOLD)
|
stdscr.addstr(status_bar_start, state.width // 2 - len(handle_text) // 2, handle_text, curses.A_REVERSE | curses.A_BOLD)
|
||||||
|
|
@ -1151,8 +1157,8 @@ def handle_mouse_input(stdscr, state: AppState) -> AppState:
|
||||||
if bstate & curses.BUTTON1_PRESSED:
|
if bstate & curses.BUTTON1_PRESSED:
|
||||||
if state.show_sidebar and abs(mx - state.divider_col) <= 1:
|
if state.show_sidebar and abs(mx - state.divider_col) <= 1:
|
||||||
return replace(state, dragging_divider=True)
|
return replace(state, dragging_divider=True)
|
||||||
elif my == status_bar_start and abs(mx - (state.width // 2)) <= 2:
|
elif my == status_bar_start and abs(mx - (state.width // 2)) <= 3:
|
||||||
# Clicked on the status bar handle
|
# Clicked on the status bar handle (wider click area)
|
||||||
return replace(state, dragging_status_bar=True)
|
return replace(state, dragging_status_bar=True)
|
||||||
else:
|
else:
|
||||||
focus = "right"
|
focus = "right"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue