Skip to content

Commit

Permalink
Truncate wrap sign in the list section if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Feb 13, 2025
1 parent 3347d61 commit 7d26eca
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3099,8 +3099,15 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
maxWidth := t.window.Width() - (indentSize + 1)
wasWrapped := false
if wrapped {
maxWidth -= t.wrapSignWidth
t.window.CPrint(colBase.WithAttr(tui.Dim), t.wrapSign)
wrapSign := t.wrapSign
if maxWidth < t.wrapSignWidth {
runes, _ := util.Truncate(wrapSign, maxWidth)
wrapSign = string(runes)
maxWidth = 0
} else {
maxWidth -= t.wrapSignWidth
}
t.window.CPrint(colBase.WithAttr(tui.Dim), wrapSign)
wrapped = false
wasWrapped = true
}
Expand Down

0 comments on commit 7d26eca

Please sign in to comment.