From 7d26eca5ccfccfea4d904aae11bfe4c8e06cd17c Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 13 Feb 2025 21:50:53 +0900 Subject: [PATCH] Truncate wrap sign in the list section if necessary --- src/terminal.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/terminal.go b/src/terminal.go index 9a4abf86..9a411b33 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -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 }