#endif /* __GNUC__ */
/* Forward declarations */
+static size_t xstrlcpy(char *dest, const char *src, size_t n);
static void redraw(char *path);
static int spawn(char *file, char *arg1, char *arg2, const char *dir, uchar flag);
static int (*nftw_fn)(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf);
static void printwait(const char *msg, int *presel)
{
printmsg(msg);
- if (presel)
+ if (presel) {
*presel = MSGWAIT;
+ if (ndents)
+ xstrlcpy(g_ctx[cfg.curctx].c_name, dents[cur].name, NAME_MAX + 1);
+ }
}
/* Kill curses and display error before exiting */
//DPRINTF_D(c);
//DPRINTF_S(keyname(c));
- if (c == ERR)
- c = 0;
+ if (c == ERR && presel == MSGWAIT)
+ c = (cfg.filtermode || filterset()) ? FILTER : CONTROL('L');
else if (c == FILTER || c == CONTROL('L'))
/* Clear previous filter when manually starting */
clearfilter();
}
sel = nextsel(presel);
- if (presel) {
- if (presel == MSGWAIT)
- statusbar(path);
+ if (presel)
presel = 0;
- }
switch (sel) {
#ifndef NOMOUSE
}
}
- /* Save current */
- if (ndents)
- copycurname();
-
if (cfg.filtermode || filterset())
presel = FILTER;
- if (r == 'd' || r == 'a')
- goto begin;
+ if (ndents) {
+ copycurname();
- qsort(dents, ndents, sizeof(*dents), entrycmpfn);
+ if (r == 'd' || r == 'a')
+ goto begin;
+
+ qsort(dents, ndents, sizeof(*dents), entrycmpfn);
+ move_cursor(ndents ? dentfind(lastname, ndents) : 0, 0);
+ }
continue;
case SEL_STATS: // fallthrough
case SEL_CHMODX: