#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 */
fsession = fopen(spath, "wb");
if (!fsession) {
- printwait(messages[MSG_ACCESS], presel);
+ printwait(messages[MSG_SEL_MISSING], presel);
return;
}
fsession = fopen(spath, "rb");
if (!fsession) {
- printmsg(messages[MSG_ACCESS]);
+ printmsg(messages[MSG_SEL_MISSING]);
xdelay(XDELAY_INTERVAL_MS);
return FALSE;
}
}
dir = strdup(name);
- if (!dir)
+ if (!dir) {
+ printwait(messages[MSG_FAILED], presel);
return FALSE;
+ }
len = strlen(dir);
> DOUBLECLICK_INTERVAL_NS)
break;
mousetimings[currentmouse].tv_sec = 0;
- } else {
- if (cfg.filtermode)
- presel = FILTER;
- goto nochange; // fallthrough
- }
+ } else
+ goto nochange;
#endif
+ // fallthrough
case SEL_NAV_IN: // fallthrough
case SEL_GOIN:
/* Cannot descend in empty directories */
setdirwatch();
goto begin;
- } else {
- printwait(messages[MSG_FAILED], &presel);
- goto nochange;
}
+
+ goto nochange;
}
if (r != 'd') {
if (cfg.filtermode)
presel = FILTER;
- if (access(newpath, F_OK) == 0) /* File not removed */
+ if (access(newpath, F_OK) == 0) { /* File not removed */
+ copycurname();
goto nochange;
- else if (cur) {
+ } else if (cur) {
cur += (cur != (ndents - 1)) ? 1 : -1;
copycurname();
} else
case SEL_TIMETYPE:
if (!set_time_type(&presel))
goto nochange;
-
goto begin;
default:
if (xlines != LINES || xcols != COLS)