Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions internal/tui/core/app/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renderTranscriptWithScrollbar 新增了 a.transcriptMaxOffset() <= 0 的早返回逻辑,但当前测试主要覆盖了“宽度过窄不渲染滚动条”和“可滚动时渲染 thumb”,没有直接覆盖“宽度充足但内容不可滚动时不渲染滚动条”的新分支。建议补一个回归用例,避免后续改动把这一行为回退。

return a.styles.streamContent.Render(content)
}

Expand All @@ -237,9 +237,8 @@ func (a App) renderTranscriptScrollbar(width int, height int) string {
return ""
}

track := strings.Repeat("|", width)
thumb := strings.Repeat("#", width)
trackStyle := lipgloss.NewStyle().Foreground(lipgloss.Color(oliveGray))
blank := strings.Repeat(" ", width)
thumb := strings.Repeat("█", width)
thumbStyle := lipgloss.NewStyle().Foreground(lipgloss.Color(purpleAccent)).Bold(true)

maxOffset := a.transcriptMaxOffset()
Expand All @@ -262,7 +261,7 @@ func (a App) renderTranscriptScrollbar(width int, height int) string {
lines = append(lines, thumbStyle.Render(thumb))
continue
}
lines = append(lines, trackStyle.Render(track))
lines = append(lines, blank)
}
return lipgloss.JoinVertical(lipgloss.Left, lines...)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/tui/core/app/view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Loading