Skip to content

Commit

Permalink
Rename rmopt param to sel
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Feb 4, 2024
1 parent 81cf2ee commit f3fe145
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/nnn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,12 +1551,12 @@ static void xdelay(useconds_t delay)
usleep(delay);
}

static char confirm_force(bool selection, enum action rmopt)
static char confirm_force(bool selection, enum action sel)
{
char str[64];

snprintf(str, 64, messages[MSG_FORCE_RM],
g_state.trash && rmopt == SEL_RM ? utils[UTIL_GIO_TRASH] + 4 : utils[UTIL_RM_RF],
g_state.trash && sel == SEL_RM ? utils[UTIL_GIO_TRASH] + 4 : utils[UTIL_RM_RF],
(selection ? "selected" : "hovered"));

int r = get_input(str);
Expand All @@ -1565,7 +1565,7 @@ static char confirm_force(bool selection, enum action rmopt)
return '\0'; /* cancel */
if (r == 'y' || r == 'Y')
return 'f'; /* forceful for rm */
return (g_state.trash && rmopt == SEL_RM ? '\0' : 'i'); /* interactive for rm */
return (g_state.trash && sel == SEL_RM ? '\0' : 'i'); /* interactive for rm */
}

/* Writes buflen char(s) from buf to a file */
Expand Down Expand Up @@ -2548,13 +2548,13 @@ static void opstr(char *buf, char *op)
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c '%s \"$0\" \"$@\" . < /dev/tty' < %s", op, selpath);
}

static bool rmmulstr(char *buf, enum action rmopt)
static bool rmmulstr(char *buf, enum action sel)
{
char r = confirm_force(TRUE, rmopt);
char r = confirm_force(TRUE, sel);
if (!r)
return FALSE;

if (!g_state.trash || rmopt == SEL_RMONLY)
if (!g_state.trash || sel == SEL_RMONLY)
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c 'rm -%cr \"$0\" \"$@\" < /dev/tty' < %s",
r, selpath);
else
Expand All @@ -2565,13 +2565,13 @@ static bool rmmulstr(char *buf, enum action rmopt)
}

/* Returns TRUE if file is removed, else FALSE */
static bool xrm(char * const fpath, enum action rmopt)
static bool xrm(char * const fpath, enum action sel)
{
char r = confirm_force(FALSE, rmopt);
char r = confirm_force(FALSE, sel);
if (!r)
return FALSE;

if (!g_state.trash || rmopt == SEL_RMONLY) {
if (!g_state.trash || sel == SEL_RMONLY) {
char rm_opts[] = "-ir";

rm_opts[1] = r;
Expand Down

0 comments on commit f3fe145

Please sign in to comment.