fix: scrolling on suggestions
This commit is contained in:
21
tui.go
21
tui.go
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user