Truncate wrap sign in the list section if necessary

This commit is contained in:
Junegunn Choi 2025-02-13 21:50:53 +09:00
parent 3347d61591
commit 7d26eca5cc
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -3099,8 +3099,15 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
maxWidth := t.window.Width() - (indentSize + 1) maxWidth := t.window.Width() - (indentSize + 1)
wasWrapped := false wasWrapped := false
if wrapped { if wrapped {
maxWidth -= t.wrapSignWidth wrapSign := t.wrapSign
t.window.CPrint(colBase.WithAttr(tui.Dim), 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 wrapped = false
wasWrapped = true wasWrapped = true
} }