mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Do not end selection mode before invoking plugin
This commit is contained in:
parent
2c32f24073
commit
62a0486480
19
src/nnn.c
19
src/nnn.c
|
@ -1785,15 +1785,16 @@ static int scanselforpath(const char *path, bool getsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish selection procedure before an operation */
|
/* Finish selection procedure before an operation */
|
||||||
static void endselection(void)
|
static void endselection(bool endselmode)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
char buf[sizeof(patterns[P_REPLACE]) + PATH_MAX + (TMP_LEN_MAX << 1)];
|
char buf[sizeof(patterns[P_REPLACE]) + PATH_MAX + (TMP_LEN_MAX << 1)];
|
||||||
|
|
||||||
if (g_state.selmode)
|
if (endselmode && g_state.selmode)
|
||||||
g_state.selmode = 0;
|
g_state.selmode = 0;
|
||||||
|
|
||||||
|
/* The code below is only for listing mode */
|
||||||
if (!listpath || !selbufpos)
|
if (!listpath || !selbufpos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -5256,7 +5257,7 @@ static bool prompt_run(const char *current)
|
||||||
|
|
||||||
static bool handle_cmd(enum action sel, const char *current, char *newpath)
|
static bool handle_cmd(enum action sel, const char *current, char *newpath)
|
||||||
{
|
{
|
||||||
endselection();
|
endselection(TRUE);
|
||||||
|
|
||||||
if (sel == SEL_PROMPT)
|
if (sel == SEL_PROMPT)
|
||||||
return prompt_run(current);
|
return prompt_run(current);
|
||||||
|
@ -5924,7 +5925,7 @@ static int set_sort_flags(int r)
|
||||||
cfg.reverse = 0;
|
cfg.reverse = 0;
|
||||||
entrycmpfn = &entrycmp;
|
entrycmpfn = &entrycmp;
|
||||||
}
|
}
|
||||||
endselection(); /* We are going to reload dir */
|
endselection(TRUE); /* We are going to reload dir */
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
cfg.timeorder = 0;
|
cfg.timeorder = 0;
|
||||||
|
@ -6719,7 +6720,7 @@ nochange:
|
||||||
g_state.runplugin = 0;
|
g_state.runplugin = 0;
|
||||||
/* Must be in plugin dir and same context to select plugin */
|
/* Must be in plugin dir and same context to select plugin */
|
||||||
if ((g_state.runctx == cfg.curctx) && !strcmp(path, plgpath)) {
|
if ((g_state.runctx == cfg.curctx) && !strcmp(path, plgpath)) {
|
||||||
endselection();
|
endselection(FALSE);
|
||||||
/* Copy path so we can return back to earlier dir */
|
/* Copy path so we can return back to earlier dir */
|
||||||
xstrsncpy(path, rundir, PATH_MAX);
|
xstrsncpy(path, rundir, PATH_MAX);
|
||||||
rundir[0] = '\0';
|
rundir[0] = '\0';
|
||||||
|
@ -7036,7 +7037,7 @@ nochange:
|
||||||
refresh = TRUE;
|
refresh = TRUE;
|
||||||
break;
|
break;
|
||||||
case SEL_RENAMEMUL:
|
case SEL_RENAMEMUL:
|
||||||
endselection();
|
endselection(TRUE);
|
||||||
|
|
||||||
if (!(getutil(utils[UTIL_BASH])
|
if (!(getutil(utils[UTIL_BASH])
|
||||||
&& plugscript(utils[UTIL_NMV], F_CLI))
|
&& plugscript(utils[UTIL_NMV], F_CLI))
|
||||||
|
@ -7224,7 +7225,7 @@ nochange:
|
||||||
? mkpath(path, xbasename(pselbuf), newpath)
|
? mkpath(path, xbasename(pselbuf), newpath)
|
||||||
: (newpath[0] = '\0');
|
: (newpath[0] = '\0');
|
||||||
|
|
||||||
endselection();
|
endselection(TRUE);
|
||||||
|
|
||||||
if (!cpmvrm_selection(sel, path)) {
|
if (!cpmvrm_selection(sel, path)) {
|
||||||
presel = MSGWAIT;
|
presel = MSGWAIT;
|
||||||
|
@ -7258,7 +7259,7 @@ nochange:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (sel != SEL_OPENWITH)
|
if (sel != SEL_OPENWITH)
|
||||||
endselection();
|
endselection(TRUE);
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_ARCHIVE:
|
case SEL_ARCHIVE:
|
||||||
|
@ -7440,7 +7441,7 @@ nochange:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r != '\r') {
|
if (r != '\r') {
|
||||||
endselection();
|
endselection(FALSE);
|
||||||
tmp = get_kv_val(plug, NULL, r, maxplug, NNN_PLUG);
|
tmp = get_kv_val(plug, NULL, r, maxplug, NNN_PLUG);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
printwait(messages[MSG_INVALID_KEY], &presel);
|
printwait(messages[MSG_INVALID_KEY], &presel);
|
||||||
|
|
Loading…
Reference in a new issue