summaryrefslogtreecommitdiff
path: root/src/tui/light.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-02-11 23:41:13 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-02-11 23:41:54 +0900
commit66ca16f836f70d90ab751dcc804bf158f0c5ae48 (patch)
tree02ffb76f928b0262c46d1f1c1d47e06d5e4d3dd0 /src/tui/light.go
parent282884ad83c9aae32519d9bb3b7d685319c26639 (diff)
downloadfzf-66ca16f836f70d90ab751dcc804bf158f0c5ae48.tar.gz
Truncate wrap signs in extremely narrow preview window
Diffstat (limited to 'src/tui/light.go')
-rw-r--r--src/tui/light.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/tui/light.go b/src/tui/light.go
index bf2a2fd2..aaa9e56f 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -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)
}
}
}