Skip to content

--preview-window wrap breaks preview scrolling in some condition. #4258

Open
@fsc0

Description

@fsc0

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.60.0 (6fa8295)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

I have a text file named preview-scroll-test.txt

Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23 ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Line 24
Line 25

And I saved below script like fzf-preview-scroll-test.sh

#!/usr/bin/env bash
: | FZF_DEFAULT_OPTS= fzf \
	--preview-window wrap \
	--preview 'cat /tmp/preview-scroll-test.txt' \
	--bind 'up:preview-page-up,down:preview-page-down'

When I execute the script.
Line 24~ is hidden cause of very precise wrapping.
And up and down bindings not working.

Image

Let's remove those X phrase on Line 23.

Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23 ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
Line 24
Line 25

Then execute the script again.
Line 24 shows up but scrolling still not working.

Image

Now restore those X phase and put a single # at the end of Line 23.

Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
Line 15
Line 16
Line 17
Line 18
Line 19
Line 20
Line 21
Line 22
Line 23 ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX#
Line 24
Line 25

Scrolling is back to work, but Line 24 is gone.

1more-result.mp4

As you can see, to reproducing this issue, user need to prepare a precise text file for their terminal setting.
Like increasing Line N and # and X. (Or using fzf's own setting.)

Note. When you adjust the terminal screen size, issue may gone.

EDIT: At the last case, Line 24 wasn't exactly gone, but only can be found with preview-down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions