From 57613de18b728fd4163964d9d8340402b70ddcab Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 20 Nov 2018 19:58:07 +0530 Subject: [PATCH] Show warnings for copy, move, multiple remove --- src/nnn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/nnn.c b/src/nnn.c index 6898bb86..d6d66a1d 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3046,11 +3046,24 @@ nochange: case SEL_MV: case SEL_RMMUL: { + /* Fail if copy file path not generated */ if (!g_cppath[0]) { printmsg("copy file not found"); goto nochange; } + /* Warn if selection not completed */ + if (cfg.copymode) { + printmsg("finish selection first"); + goto nochange; + } + + /* Fail if copy file path isn't created */ + if (access(g_cppath, R_OK) == -1) { + printmsg("empty selection list"); + goto nochange; + } + if (sel == SEL_CP) snprintf(g_buf, MAX_CMD_LEN, "xargs -0 -d \'\n\' -a %s cp -ir --preserve=all -t .", g_cppath); else if (sel == SEL_MV)