m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 07:43:39 -05:00

Truncate wrap signs in extremely narrow preview window

This commit is contained in:
Junegunn Choi
2025-02-11 23:41:13 +09:00
parent 282884ad83
commit 66ca16f836
2 changed files with 18 additions and 3 deletions

View File

@@ -1159,9 +1159,16 @@ func (w *LightWindow) fill(str string, resetCode string) FillReturn {
w.Move(w.posy+1, 0)
w.renderer.stderr(resetCode)
if len(lines) > 1 {
w.stderrInternal(DIM+w.wrapSign, false, resetCode)
sign := w.wrapSign
width := w.wrapSignWidth
if width > w.width-w.posx {
runes, truncatedWidth := util.Truncate(w.wrapSign, w.width-w.posx)
sign = string(runes)
width = truncatedWidth
}
w.stderrInternal(DIM+sign, false, resetCode)
w.renderer.stderr(resetCode)
w.Move(w.posy, w.wrapSignWidth)
w.Move(w.posy, width)
}
}
}