aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-06 22:06:36 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-06 22:06:36 +0530
commit0950f058f1bf634aa787c88d6b4f0f53e2956761 (patch)
treeed3768a52a3257f09946adeebddf75dc799d8924
parentcdcbb82a91291d708c10e11a17b3af9c67d4c7bb (diff)
downloadnnn-0950f058f1bf634aa787c88d6b4f0f53e2956761.tar.gz
Archive: check archive mode first
-rw-r--r--src/nnn.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 00ac1f4..16170f2 100644
--- 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",