Fix bug in fzopen when selection is canceled

This commit is contained in:
Tadeas Uhlir 2023-08-12 17:41:30 +02:00
parent 186f9d01ea
commit e500179188

View file

@ -59,25 +59,27 @@ if [ "$3" ]; then
exit 0 exit 0
fi fi
if [ "$USE_NUKE" -ne 0 ]; then if [ "$entry" ]; then
if [ "$USE_NUKE" -ne 0 ]; then
"$NUKE" "$entry" "$NUKE" "$entry"
exit 0 exit 0
fi fi
# Open the file (works for a single file only) # Open the file (works for a single file only)
cmd_file="" cmd_file=""
cmd_open="" cmd_open=""
if uname | grep -q "Darwin"; then if uname | grep -q "Darwin"; then
cmd_file="file -bIL" cmd_file="file -bIL"
cmd_open="open" cmd_open="open"
else else
cmd_file="file -biL" cmd_file="file -biL"
cmd_open="xdg-open" cmd_open="xdg-open"
fi fi
case "$($cmd_file "$entry")" in case "$($cmd_file "$entry")" in
*text*) *text*)
"${VISUAL:-$EDITOR}" "$entry" ;; "${VISUAL:-$EDITOR}" "$entry" ;;
*) *)
$cmd_open "$entry" >/dev/null 2>&1 ;; $cmd_open "$entry" >/dev/null 2>&1 ;;
esac esac
fi