}
/* Finish selection procedure before an operation */
-static void endselection(void)
+static void endselection(bool endselmode)
{
int fd;
ssize_t count;
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;
+ /* The code below is only for listing mode */
if (!listpath || !selbufpos)
return;
static bool handle_cmd(enum action sel, const char *current, char *newpath)
{
- endselection();
+ endselection(TRUE);
if (sel == SEL_PROMPT)
return prompt_run(current);
cfg.reverse = 0;
entrycmpfn = &entrycmp;
}
- endselection(); /* We are going to reload dir */
+ endselection(TRUE); /* We are going to reload dir */
break;
case 'c':
cfg.timeorder = 0;
g_state.runplugin = 0;
/* Must be in plugin dir and same context to select plugin */
if ((g_state.runctx == cfg.curctx) && !strcmp(path, plgpath)) {
- endselection();
+ endselection(FALSE);
/* Copy path so we can return back to earlier dir */
xstrsncpy(path, rundir, PATH_MAX);
rundir[0] = '\0';
refresh = TRUE;
break;
case SEL_RENAMEMUL:
- endselection();
+ endselection(TRUE);
if (!(getutil(utils[UTIL_BASH])
&& plugscript(utils[UTIL_NMV], F_CLI))
? mkpath(path, xbasename(pselbuf), newpath)
: (newpath[0] = '\0');
- endselection();
+ endselection(TRUE);
if (!cpmvrm_selection(sel, path)) {
presel = MSGWAIT;
break;
if (sel != SEL_OPENWITH)
- endselection();
+ endselection(TRUE);
switch (sel) {
case SEL_ARCHIVE:
}
if (r != '\r') {
- endselection();
+ endselection(FALSE);
tmp = get_kv_val(plug, NULL, r, maxplug, NNN_PLUG);
if (!tmp) {
printwait(messages[MSG_INVALID_KEY], &presel);