Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview window: cursor flickers in preview window, happens more often in tmux than outside of it #2588

Closed
5 of 10 tasks
poetaman opened this issue Aug 15, 2021 · 1 comment
Closed
5 of 10 tasks

Comments

@poetaman
Copy link

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

At times while navigating the fzf items with preview window open makes cursor appear & disappear in different locations of the preview window.

Steps:

  1. Open Alacritty window or iTerm2 window.
  2. Launch tmux.
  3. Go to some directory with a lot of files to run fzf from
  4. Open fzf with command fzf --ansi --preview='echo {}', or fzf-tmux --ansi --preview='echo {}
  5. Move up/down arrow key, it might require sprints of pressing and holding the arrow keys, abruptly releasing and repeating the procedure till you see cursor if flickering in the window.

This could have to do with the terminfo extension Sync mentioned in man tmux under section TERMINFO EXTENSIONS, though I don't know for sure (@nicm might be of help on that front). I know for sure its not my terminfo that has any problem as other program's cursor doesn't flicker anymore...

Demo:

previewcursor.mp4
@ins0mniaque
Copy link

ins0mniaque commented Mar 20, 2022

Can confirm it still happens with latest fzf on macOS/zsh.

This was really annoying me so I hacked a workaround by wrapping fzf and fully hiding the cursor while fzf is running.
Since fzf is so great at fuzzy matching, I never end up having to edit what I'm typing, so I really don't mind not seeing it while I type.

Keys could also be bound to show/hide the cursor. tput civis >/dev/tty 2>/dev/null will hide the cursor and tput cnorm >/dev/tty 2>/dev/null will restore it.

The following can be added to your .zshrc file to hide the cursor while fzf or fzf-tmux is running. A similar workaround can be done with other shells.

Add to ~./zshrc

# Hide cursor while fzf is running: https://github.com/junegunn/fzf/issues/2588
fzf()
{
    tput civis >/dev/tty 2>/dev/null

    command fzf "$@"
    local exit_code=$?

    tput cnorm >/dev/tty 2>/dev/null

    return $exit_code
}

fzf-tmux()
{
    tput civis >/dev/tty 2>/dev/null

    command fzf-tmux "$@"
    local exit_code=$?

    tput cnorm >/dev/tty 2>/dev/null

    return $exit_code
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants