Skip to content
Myr

Fix cursor position when prompt is truncated

Before adoption: this commit came in with the history the project adopted, so no landing records it.

e.g. fzf --preview 'cat {}' --prompt "$(seq 100 | xargs)" fzf --preview 'cat {}' --prompt "$(seq 100 | xargs)" --input-border

authored by Junegunn Choi · committed by Junegunn Choi · parent 82fd883 · Browse files · 1 file+9 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−3 removed

  • other:+9 added−3 removed

1 file+9 added−3 removed

modified:src/terminal.go+9 added-3 removed
1304 unmodified lines
1305 wrap := t.wrap1306 t.wrap = false1307 t.withWindow(t.inputWindow, func() {1308 line := t.promptLine()1309 preTask := func(markerClass) int {1310 return 11311 }1312 t.printHighlighted(1310 Result{item: item}, tui.ColPrompt, tui.ColPrompt, false, false, line, line, true, nil, nil)1313 Result{item: item}, tui.ColPrompt, tui.ColPrompt, false, false, line, line, true, preTask, nil)1314 })1315 t.wrap = wrap1316 }1317 _, promptLen := t.processTabs([]rune(trimmed), 0)
1025 unmodified lines
2343func (t *Terminal) placeCursor() {2344 if t.inputless {2345 return2346 }2347 x := t.promptLen + t.queryLen[0]2348 if t.inputWindow != nil {2349 y := t.inputWindow.Height() - 12350 if t.layout == layoutReverse {2351 y = 02352 }2349 t.inputWindow.Move(y, t.promptLen+t.queryLen[0])2353 x = util.Min(x, t.inputWindow.Width()-1)2354 t.inputWindow.Move(y, x)2355 return2356 }2357 x = util.Min(x, t.window.Width()-1)2352 t.move(t.promptLine(), t.promptLen+t.queryLen[0], false)2358 t.move(t.promptLine(), x, false)2359}23602361func (t *Terminal) printPrompt() {2362 if t.inputless {
3966 unmodified lines