fix: scrolling on suggestions

This commit is contained in:
2026-08-03 11:42:35 +02:00
parent 4f2b508154
commit 81f3f7d369
5 changed files with 125 additions and 17 deletions

21
tui.go
View File

@@ -3766,27 +3766,16 @@ func (m App) detailLines(width int) []detailLine {
}
}
for suggestionIndex, suggestion := range content.Suggestions {
removed, added := normalizeSuggestion(reviewedSourceLines(thread, comment), suggestion)
removedRanges, addedRanges := suggestionChangedRanges(removed, added)
label := "suggested change"
if len(content.Suggestions) > 1 {
label = fmt.Sprintf("suggested change %d/%d", suggestionIndex+1, len(content.Suggestions))
}
lines = append(lines, detailLine{rail: rail}, detailLine{rail: rail, text: dimStyle.Render(label)})
for sourceIndex, source := range removed {
lines = append(lines, addCommentRail(
wrapSuggestionLine(
thread.Path, source, '-', removedRanges[sourceIndex], max(1, width-4),
), rail,
)...)
}
for sourceIndex, source := range added {
lines = append(lines, addCommentRail(
wrapSuggestionLine(
thread.Path, source, '+', addedRanges[sourceIndex], max(1, width-4),
), rail,
)...)
}
rendered := renderSuggestion(
thread.Path, reviewedSourceLines(thread, comment), suggestion, max(1, width-4),
)
lines = append(lines, addCommentRail(rendered.removed, rail)...)
lines = append(lines, addCommentRail(rendered.added, rail)...)
}
for reactionIndex, reactionLine := range renderReactionSummary(
comment.Reactions, max(1, width-4),