m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 15:53: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

@@ -766,10 +766,18 @@ Loop:
xPos := w.left + w.lastX + lx
if xPos >= w.left+w.width {
w.lastY++
if w.lastY >= w.height {
return FillSuspend
}
w.lastX = 0
lx = 0
xPos = w.left
wgr := uniseg.NewGraphemes(w.wrapSign)
sign := w.wrapSign
if w.wrapSignWidth > w.width {
runes, _ := util.Truncate(sign, w.width)
sign = string(runes)
}
wgr := uniseg.NewGraphemes(sign)
for wgr.Next() {
rs := wgr.Runes()
_screen.SetContent(w.left+lx, w.top+w.lastY, rs[0], rs[1:], style.Dim(true))