From c2908199c80b17aff2bf32da2b3598bbcb83cfa1 Mon Sep 17 00:00:00 2001 From: creatang Date: Fri, 24 Apr 2026 11:49:00 +0800 Subject: [PATCH] fix(tui): render thumb-only transcript scrollbar --- internal/tui/core/app/view.go | 12 ++++++------ internal/tui/core/app/view_test.go | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/tui/core/app/view.go b/internal/tui/core/app/view.go index ac5a07c9..b91ebd48 100644 --- a/internal/tui/core/app/view.go +++ b/internal/tui/core/app/view.go @@ -215,7 +215,7 @@ func (a App) renderWaterfall(width int, height int) string { func (a App) renderTranscriptWithScrollbar(totalWidth int, content string) string { scrollbarWidth := a.transcriptScrollbarWidth(totalWidth) - if scrollbarWidth <= 0 { + if scrollbarWidth <= 0 || a.transcriptMaxOffset() <= 0 { return a.styles.streamContent.Render(content) } @@ -237,9 +237,9 @@ func (a App) renderTranscriptScrollbar(width int, height int) string { return "" } - track := strings.Repeat(" ", width) - trackStyle := lipgloss.NewStyle().UnsetBackground() - thumbStyle := lipgloss.NewStyle().UnsetBackground() + blank := strings.Repeat(" ", width) + thumb := strings.Repeat("█", width) + thumbStyle := lipgloss.NewStyle().Foreground(lipgloss.Color(purpleAccent)).Bold(true) maxOffset := a.transcriptMaxOffset() thumbHeight := height @@ -258,10 +258,10 @@ func (a App) renderTranscriptScrollbar(width int, height int) string { lines := make([]string, 0, height) for row := 0; row < height; row++ { if row >= thumbTop && row < thumbTop+thumbHeight { - lines = append(lines, thumbStyle.Render(track)) + lines = append(lines, thumbStyle.Render(thumb)) continue } - lines = append(lines, trackStyle.Render(track)) + lines = append(lines, blank) } return lipgloss.JoinVertical(lipgloss.Left, lines...) } diff --git a/internal/tui/core/app/view_test.go b/internal/tui/core/app/view_test.go index 6446944e..dcdbba91 100644 --- a/internal/tui/core/app/view_test.go +++ b/internal/tui/core/app/view_test.go @@ -769,6 +769,8 @@ func TestRenderActivityLineAndScrollbarHelpers(t *testing.T) { app.transcript.SetYOffset(3) if got := app.renderTranscriptScrollbar(2, 5); got == "" { t.Fatalf("expected non-empty scrollbar when transcript is scrollable") + } else if !strings.Contains(got, "█") { + t.Fatalf("expected scrollbar thumb to use solid block glyph, got %q", got) } }