junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
64.33k stars 2.38k forks source link

Bind option doesnt work always #3750

Closed og900aero closed 5 months ago

og900aero commented 5 months ago

Checklist

Output of fzf --version

0.50.0 (f97d275)

OS

Shell

Problem / Steps to reproduce

I'm using Debian 12 and the included fzf 0.38.0. I use the following script to open files or folders:

#!/usr/bin/bash

selection=$(find / -type f ! -path "/proc/*" ! -path "/mnt/*" 2>/dev/null | fzf --exact --multi --height=80% --border=sharp --color='fg+:red' \
--preview='batcat {}' --preview-window='45%,border-sharp' \
--prompt='Files > ' \
--bind='del:execute(rm -ri {+})' \
--bind='ctrl-p:toggle-preview' \
--bind='ctrl-d:reload(find / -type d ! -path "/proc/*" ! -path "/mnt/*" 2>/dev/null)' \
--bind='ctrl-d:+change-prompt(Dirs > )' \
--bind='ctrl-d:+change-preview(tree -C {})' \
--bind='ctrl-d:+refresh-preview' \
--bind='ctrl-f:change-prompt(Files > )' \
--bind='ctrl-f:+reload(find / -type f ! -path "/proc/*" ! -path "/mnt/*" 2>/dev/null)' \
--bind='ctrl-f:+change-preview(batcat {})' \
--bind='ctrl-f:+refresh-preview' \
--header '
CTRL-D to display directories | CTRL-F to display files
ENTER to edit | DEL to delete
CTRL-P to toggle preview
'
)

if [ -d "$selection" ]; then
    cd $selection || exit
elif [ -f "$selection" ]; then
    if sudo -u "$USER" test -w "$selection"; then
        eval "nano $selection"
exit
    else
        eval "sudo nano $selection"
exit
    fi
fi

When I move fresh fzf, then not working to switch directory. The prompt changes to Dirs, but the find function still show files. When move back 0.38.0 version, then working again.

junegunn commented 5 months ago

Thanks for the report. It was a regression in 0.49.0.