]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix bug in fzopen when selection is canceled
authorTadeas Uhlir <tadeas.uhlir@gmail.com>
Sat, 12 Aug 2023 15:41:30 +0000 (17:41 +0200)
committerTadeas Uhlir <tadeas.uhlir@gmail.com>
Sat, 12 Aug 2023 15:45:14 +0000 (17:45 +0200)
plugins/fzopen

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