mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Fix cmd as plugin showing prompt on playing twice
This commit is contained in:
parent
6b5bb16b46
commit
ac281cb63b
17
src/nnn.c
17
src/nnn.c
|
@ -3553,28 +3553,27 @@ static void show_help(const char *path)
|
||||||
unlink(g_tmpfpath);
|
unlink(g_tmpfpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool run_cmd_as_plugin(const char *path, char *file, char *newpath, char *runfile)
|
static bool run_cmd_as_plugin(const char *path, const char *file, char *newpath, char *runfile)
|
||||||
{
|
{
|
||||||
uchar flags = F_CLI | F_CONFIRM;
|
uchar flags = F_CLI | F_CONFIRM;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
DPRINTF_S(file);
|
|
||||||
|
|
||||||
/* Get rid of preceding _ */
|
/* Get rid of preceding _ */
|
||||||
++file;
|
++file;
|
||||||
|
|
||||||
if (!*file)
|
if (!*file)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
len = strlen(file);
|
xstrlcpy(newpath, file, PATH_MAX);
|
||||||
if (len > 1 && file[len - 1] == '*') {
|
|
||||||
|
len = strlen(newpath);
|
||||||
|
if (len > 1 && newpath[len - 1] == '*') {
|
||||||
flags &= ~F_CONFIRM; /* GUI case */
|
flags &= ~F_CONFIRM; /* GUI case */
|
||||||
file[len - 1] = '\0'; /* Get rid of trailing nowait symbol */
|
newpath[len - 1] = '\0'; /* Get rid of trailing nowait symbol */
|
||||||
--len;
|
--len;
|
||||||
}
|
}
|
||||||
|
|
||||||
xstrlcpy(newpath, file, PATH_MAX);
|
if (is_suffix(newpath, " $nnn")) {
|
||||||
if (is_suffix(file, " $nnn")) {
|
|
||||||
/* Set `\0` to clear ' $nnn' suffix */
|
/* Set `\0` to clear ' $nnn' suffix */
|
||||||
newpath[len - 5] = '\0';
|
newpath[len - 5] = '\0';
|
||||||
} else
|
} else
|
||||||
|
@ -3599,7 +3598,7 @@ static bool plctrl_init(void)
|
||||||
return _SUCCESS;
|
return _SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool run_selected_plugin(char **path, char *file, char *newpath, char *runfile, char **lastname, char **lastdir)
|
static bool run_selected_plugin(char **path, const char *file, char *newpath, char *runfile, char **lastname, char **lastdir)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
Loading…
Reference in a new issue