summaryrefslogtreecommitdiff
path: root/src/terminal.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-02-22 19:05:30 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-02-22 19:05:30 +0900
commitd79902ae595db726fa644fd441f9bc5d2a733285 (patch)
tree6bb824ff7b1012b88162e76b1493057e3dc8cadf /src/terminal.go
parent77568e114ff531f4fe14cfaeab6febd53a99b1bc (diff)
downloadfzf-d79902ae595db726fa644fd441f9bc5d2a733285.tar.gz
Fix 'jump' when pointer is empty
Fix #4270
Diffstat (limited to 'src/terminal.go')
-rw-r--r--src/terminal.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/terminal.go b/src/terminal.go
index e4fdd394..bf74b77b 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -2755,11 +2755,15 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
item := result.item
_, selected := t.selected[item.Index()]
label := ""
+ extraWidth := 0
if t.jumping != jumpDisabled {
if index < len(t.jumpLabels) {
// Striped
current = index%2 == 0
- label = t.jumpLabels[index:index+1] + strings.Repeat(" ", t.pointerLen-1)
+ label = t.jumpLabels[index:index+1] + strings.Repeat(" ", util.Max(0, t.pointerLen-1))
+ if t.pointerLen == 0 {
+ extraWidth = 1
+ }
}
} else if current {
label = t.pointer
@@ -2788,6 +2792,7 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
maxWidth := t.window.Width() - (t.pointerLen + t.markerLen + 1)
postTask := func(lineNum int, width int, wrapped bool, forceRedraw bool) {
+ width += extraWidth
if (current || selected) && t.highlightLine {
color := tui.ColSelected
if current {