fix: Improve status bar rendering and commit message display
This commit is contained in:
parent
a804ebe85a
commit
c2c678b8b3
28
gtm
28
gtm
|
|
@ -883,12 +883,13 @@ def draw_status_bars(stdscr, state):
|
||||||
# Use terminal's default colors for the status bar
|
# Use terminal's default colors for the status bar
|
||||||
status_attr = curses.A_NORMAL # Use terminal's default colors
|
status_attr = curses.A_NORMAL # Use terminal's default colors
|
||||||
|
|
||||||
# Fill the top status bar with spaces using reverse video
|
# Fill all status bar lines with spaces using reverse video
|
||||||
for x in range(state.width - 1):
|
for y in range(state.status_bar_height):
|
||||||
try:
|
for x in range(state.width - 1):
|
||||||
stdscr.addch(status_bar_start, x, ' ', curses.A_REVERSE)
|
try:
|
||||||
except curses.error:
|
stdscr.addch(state.height - state.status_bar_height + y, x, ' ', curses.A_REVERSE)
|
||||||
pass
|
except curses.error:
|
||||||
|
pass
|
||||||
|
|
||||||
# Add left percentage indicator (only if sidebar is visible)
|
# Add left percentage indicator (only if sidebar is visible)
|
||||||
if state.show_sidebar:
|
if state.show_sidebar:
|
||||||
|
|
@ -926,19 +927,11 @@ def draw_status_bars(stdscr, state):
|
||||||
right_attr = status_attr if state.focus == "right" else curses.A_REVERSE
|
right_attr = status_attr if state.focus == "right" else curses.A_REVERSE
|
||||||
stdscr.addstr(status_bar_start, right_x, padded_right_status, right_attr)
|
stdscr.addstr(status_bar_start, right_x, padded_right_status, right_attr)
|
||||||
except curses.error:
|
except curses.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# --- Second status bar (bottom) ---
|
# --- Second status bar (bottom) ---
|
||||||
# Draw the commit details in the second status bar
|
# Draw the commit details in the second status bar
|
||||||
|
|
||||||
# Fill all status bar lines with spaces using reverse video
|
|
||||||
for y in range(state.status_bar_height):
|
|
||||||
for x in range(state.width - 1):
|
|
||||||
try:
|
|
||||||
stdscr.addch(state.height - state.status_bar_height + y, x, ' ', curses.A_REVERSE)
|
|
||||||
except curses.error:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Draw the commit hash and message on the left
|
# Draw the commit hash and message on the left
|
||||||
if state.commit_hash:
|
if state.commit_hash:
|
||||||
commit_info = f" {state.commit_hash} "
|
commit_info = f" {state.commit_hash} "
|
||||||
|
|
@ -956,11 +949,10 @@ def draw_status_bars(stdscr, state):
|
||||||
message_lines = [""]
|
message_lines = [""]
|
||||||
|
|
||||||
# Calculate how many message lines we can display
|
# Calculate how many message lines we can display
|
||||||
# We need at least one line for the status bar with hash and author
|
|
||||||
available_message_lines = state.status_bar_height - 1
|
available_message_lines = state.status_bar_height - 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Draw the commit hash with bold on the bottom line of the status bar
|
# Always draw the commit hash and first line of message on the bottom line
|
||||||
bottom_line = state.height - 1
|
bottom_line = state.height - 1
|
||||||
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)
|
||||||
|
|
||||||
|
|
@ -982,7 +974,7 @@ def draw_status_bars(stdscr, state):
|
||||||
line_available_width = state.width - 4 # Leave some margin
|
line_available_width = state.width - 4 # Leave some margin
|
||||||
if len(line) > line_available_width:
|
if len(line) > line_available_width:
|
||||||
line = line[:line_available_width-3] + "..."
|
line = line[:line_available_width-3] + "..."
|
||||||
# Draw the line with some indentation
|
# Draw the line with some indentation (going upward from the bottom line)
|
||||||
line_y = bottom_line - i
|
line_y = bottom_line - i
|
||||||
stdscr.addstr(line_y, 4, line, curses.A_REVERSE)
|
stdscr.addstr(line_y, 4, line, curses.A_REVERSE)
|
||||||
except curses.error:
|
except curses.error:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue