From b50a2def03b1149df12d4c8e153a558bfdf97a8c Mon Sep 17 00:00:00 2001 From: n loewen Date: Sun, 8 Jun 2025 09:46:20 +0100 Subject: [PATCH] refactor: Simplify commit details display by removing pipe characters and adjusting layout --- gtm | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/gtm b/gtm index 6aa4b5a..09c1868 100755 --- a/gtm +++ b/gtm @@ -940,17 +940,13 @@ def draw_commit_details(stdscr, state: AppState, layout: StatusBarLayout): # Draw on the second line of the status bar (layout.commit_detail_start_y) second_line = layout.commit_detail_start_y - # Draw the commit hash with bold at the start + # Draw the commit hash at the start commit_info = f" {state.commit_hash} " - stdscr.addstr(second_line, 0, commit_info, curses.A_REVERSE | curses.A_BOLD) + stdscr.addstr(second_line, 0, commit_info, curses.A_REVERSE) # | curses.A_BOLD) # Calculate the author and branch info, ensuring it always fits author_branch_info = f" {state.commit_author} [{state.commit_branch}] " - # Reserve space for author/branch info and ensure it fits - min_author_space = 20 # Minimum space to reserve for author info - max_author_width = max(min_author_space, len(author_branch_info)) - # If the author info is too long, truncate it but keep the branch if len(author_branch_info) > layout.screen_width // 3: # Don't let it take more than 1/3 of screen max_author_name_width = (layout.screen_width // 3) - len(f" [{state.commit_branch}] ") @@ -964,62 +960,37 @@ def draw_commit_details(stdscr, state: AppState, layout: StatusBarLayout): # Calculate the message area boundaries message_start_x = len(commit_info) message_end_x = right_x - 1 - message_width = message_end_x - message_start_x - 2 # -2 for the pipe characters + message_width = message_end_x - message_start_x - # Always draw the author/branch info (it should fit now) if right_x >= len(commit_info): try: stdscr.addstr(second_line, right_x, author_branch_info, curses.A_REVERSE) except curses.error: pass - # Draw left pipe character for message area - try: - stdscr.addstr(second_line, message_start_x, "|", curses.A_REVERSE) - except curses.error: - pass - # Draw the commit message in the remaining space first_line = message_lines[0] if message_lines else "" if message_width > 0: if len(first_line) > message_width: first_line = first_line[:message_width-3] + "..." try: - stdscr.addstr(second_line, message_start_x + 1, first_line, curses.A_REVERSE) + stdscr.addstr(second_line, message_start_x, first_line, curses.A_REVERSE) except curses.error: pass # Silently fail if we can't draw the message - # Draw right pipe character for message area - try: - stdscr.addstr(second_line, message_end_x, "|", curses.A_REVERSE) - except curses.error: - pass - # Draw additional lines of the commit message if we have more space for i, line in enumerate(message_lines[1:], 1): line_y = layout.commit_detail_start_y + i if line_y >= layout.start_y + layout.total_height: break # No more space - # For continuation lines, align them with the first line of the message - # and add pipe characters on both sides - try: - stdscr.addstr(line_y, message_start_x, "|", curses.A_REVERSE) - except curses.error: - pass - if message_width > 0: if len(line) > message_width: line = line[:message_width-3] + "..." try: - stdscr.addstr(line_y, message_start_x + 1, line, curses.A_REVERSE) + stdscr.addstr(line_y, message_start_x, line, curses.A_REVERSE) except curses.error: pass - - try: - stdscr.addstr(line_y, message_end_x, "|", curses.A_REVERSE) - except curses.error: - pass def draw_search_mode(stdscr, state: AppState, layout: StatusBarLayout): """Draw search input interface"""