]> Sergey Matveev's repositories - nnn.git/commitdiff
Archive: check archive mode first
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 6 Feb 2019 16:36:36 +0000 (22:06 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 6 Feb 2019 16:36:36 +0000 (22:06 +0530)
src/nnn.c

index 00ac1f4b2233440b593919366512c2a3e69a08e3..16170f22e80bcb27e3c6c984438236bd2afbe9fe 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3625,15 +3625,22 @@ nochange:
                                presel = FILTER;
                        goto begin;
                }
-               case SEL_ARCHIVE: // fallthrough
                case SEL_OPENWITH: // fallthrough
                case SEL_RENAME:
                        if (!ndents)
                                break; // fallthrough
+               case SEL_ARCHIVE: // fallthrough
                case SEL_NEW:
                {
                        switch (sel) {
                        case SEL_ARCHIVE:
+                               r = get_input("archive selection (else current)? [s]");
+                               if (r == 's' && !cpsafe())
+                                       goto nochange;
+                               else if (!ndents) {
+                                       printmsg("no files");
+                                       goto nochange;
+                               }
                                tmp = xreadline(NULL, "archive name: ");
                                break;
                        case SEL_OPENWITH:
@@ -3670,11 +3677,7 @@ nochange:
                                        goto nochange;
                                }
 
-                               r = get_input("archive selection (else current)? [s]");
                                if (r == 's') {
-                                       if (!cpsafe())
-                                               goto nochange;
-
                                        snprintf(g_buf, CMD_LEN_MAX,
 #ifdef __linux__
                                                 "xargs -0 -a %s %s %s",