mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Fix #675
This commit is contained in:
parent
53bbcbc223
commit
1d8a14c6b4
29
src/nnn.c
29
src/nnn.c
|
@ -902,7 +902,11 @@ static char confirm_force(bool selection)
|
||||||
snprintf(str, 32, messages[MSG_FORCE_RM],
|
snprintf(str, 32, messages[MSG_FORCE_RM],
|
||||||
(selection ? xitoa(nselected) : "current"), (selection ? "(s)" : ""));
|
(selection ? xitoa(nselected) : "current"), (selection ? "(s)" : ""));
|
||||||
|
|
||||||
if (xconfirm(get_input(str)))
|
int r = get_input(str);
|
||||||
|
|
||||||
|
if (r == 27)
|
||||||
|
return '\0'; /* cancel */
|
||||||
|
if (r == 'y' || r == 'Y')
|
||||||
return 'f'; /* forceful */
|
return 'f'; /* forceful */
|
||||||
return 'i'; /* interactive */
|
return 'i'; /* interactive */
|
||||||
}
|
}
|
||||||
|
@ -1806,13 +1810,21 @@ static void opstr(char *buf, char *op)
|
||||||
op, selpath);
|
op, selpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rmmulstr(char *buf)
|
static bool rmmulstr(char *buf)
|
||||||
{
|
{
|
||||||
if (g_state.trash)
|
if (g_state.trash)
|
||||||
snprintf(buf, CMD_LEN_MAX, "xargs -0 trash-put < %s", selpath);
|
snprintf(buf, CMD_LEN_MAX, "xargs -0 trash-put < %s", selpath);
|
||||||
else
|
else {
|
||||||
|
char r = confirm_force(TRUE);
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c 'rm -%cr \"$0\" \"$@\" < /dev/tty' < %s",
|
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c 'rm -%cr \"$0\" \"$@\" < /dev/tty' < %s",
|
||||||
confirm_force(TRUE), selpath);
|
r, selpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns TRUE if file is removed, else FALSE */
|
/* Returns TRUE if file is removed, else FALSE */
|
||||||
|
@ -1824,6 +1836,9 @@ static bool xrm(char *fpath)
|
||||||
char rm_opts[] = "-ir";
|
char rm_opts[] = "-ir";
|
||||||
|
|
||||||
rm_opts[1] = confirm_force(FALSE);
|
rm_opts[1] = confirm_force(FALSE);
|
||||||
|
if (!rm_opts[1])
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
spawn("rm", rm_opts, fpath, F_NORMAL | F_CHKRTN);
|
spawn("rm", rm_opts, fpath, F_NORMAL | F_CHKRTN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1922,8 +1937,10 @@ static bool cpmvrm_selection(enum action sel, char *path)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: /* SEL_RM */
|
default: /* SEL_RM */
|
||||||
rmmulstr(g_buf);
|
if (!rmmulstr(g_buf)) {
|
||||||
break;
|
printmsg(messages[MSG_CANCEL]);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel != SEL_CPMVAS && spawn(utils[UTIL_SH_EXEC], g_buf, NULL, F_CLI | F_CHKRTN)) {
|
if (sel != SEL_CPMVAS && spawn(utils[UTIL_SH_EXEC], g_buf, NULL, F_CLI | F_CHKRTN)) {
|
||||||
|
|
Loading…
Reference in a new issue