Skip to content

Commit 4e85f72

Browse files
committed
Fix extra scroll offset in multi-line mode (--read0 or --wrap)
Fix #3950
1 parent dd0737a commit 4e85f72

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/terminal.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -4850,11 +4850,18 @@ func (t *Terminal) constrain() {
48504850
linesSum := 0
48514851

48524852
add := func(i int) bool {
4853-
lines, _ := t.numItemLines(t.merger.Get(i).item, numItems-linesSum)
4853+
lines, overflow := t.numItemLines(t.merger.Get(i).item, numItems-linesSum)
48544854
linesSum += lines
48554855
if linesSum >= numItems {
4856-
if numItemsFound == 0 {
4857-
numItemsFound = 1
4856+
/*
4857+
# Should show all 3 items
4858+
printf "file1\0file2\0file3\0" | fzf --height=5 --read0 --bind load:last --reverse
4859+
4860+
# Should not truncate the last item
4861+
printf "file\n1\0file\n2\0file\n3\0" | fzf --height=5 --read0 --bind load:last --reverse
4862+
*/
4863+
if numItemsFound == 0 || !overflow {
4864+
numItemsFound++
48584865
}
48594866
return false
48604867
}

0 commit comments

Comments
 (0)