Remove from selection when hovered entry is deleted

This commit is contained in:
Arun Prakash Jana 2021-07-16 03:54:19 +05:30
parent 3ef50f06f8
commit fa0f9ddc93
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -2373,6 +2373,17 @@ static bool xdiraccess(const char *path)
return TRUE; return TRUE;
} }
static bool plugscript(const char *plugin, uchar_t flags)
{
mkpath(plgpath, plugin, g_buf);
if (!access(g_buf, X_OK)) {
spawn(g_buf, NULL, NULL, NULL, flags);
return TRUE;
}
return FALSE;
}
static void opstr(char *buf, char *op) static void opstr(char *buf, char *op)
{ {
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c '%s \"$0\" \"$@\" . < /dev/tty' < %s", snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c '%s \"$0\" \"$@\" . < /dev/tty' < %s",
@ -2396,7 +2407,7 @@ static bool rmmulstr(char *buf)
} }
/* Returns TRUE if file is removed, else FALSE */ /* Returns TRUE if file is removed, else FALSE */
static bool xrm(char *fpath) static bool xrm(char * const fpath)
{ {
char r = confirm_force(FALSE); char r = confirm_force(FALSE);
if (!r) if (!r)
@ -2414,6 +2425,24 @@ static bool xrm(char *fpath)
return (access(fpath, F_OK) == -1); /* File is removed */ return (access(fpath, F_OK) == -1); /* File is removed */
} }
static void xrmfromsel(char *path, char *fpath)
{
bool selected = TRUE;
if ((pdents[cur].flags & DIR_OR_DIRLNK) && scanselforpath(fpath, FALSE))
clearselection();
else if (pdents[cur].flags & FILE_SELECTED) {
--nselected;
rmfromselbuf(mkpath(path, pdents[cur].name, g_buf));
} else
selected = FALSE;
#ifndef NOX11
if (selected && cfg.x11)
plugscript(utils[UTIL_CBCP], F_NOWAIT | F_NOTRACE);
#endif
}
static uint_t lines_in_file(int fd, char *buf, size_t buflen) static uint_t lines_in_file(int fd, char *buf, size_t buflen)
{ {
ssize_t len; ssize_t len;
@ -5145,17 +5174,6 @@ static bool run_plugin(char **path, const char *file, char *runfile, char **last
return TRUE; return TRUE;
} }
static bool plugscript(const char *plugin, uchar_t flags)
{
mkpath(plgpath, plugin, g_buf);
if (!access(g_buf, X_OK)) {
spawn(g_buf, NULL, NULL, NULL, flags);
return TRUE;
}
return FALSE;
}
static bool launch_app(char *newpath) static bool launch_app(char *newpath)
{ {
int r = F_NORMAL; int r = F_NORMAL;
@ -7156,6 +7174,8 @@ nochange:
if (!xrm(newpath)) if (!xrm(newpath))
continue; continue;
xrmfromsel(tmp, newpath);
copynextname(lastname); copynextname(lastname);
if (cfg.filtermode || filterset()) if (cfg.filtermode || filterset())