Retain hovered file name in filtered view with delayed msg

This commit is contained in:
Arun Prakash Jana 2020-03-28 12:25:35 +05:30
parent b87cdcde60
commit c3ff380354
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 18 additions and 15 deletions

View File

@ -689,6 +689,7 @@ static haiku_nm_h haiku_hnd;
#endif /* __GNUC__ */ #endif /* __GNUC__ */
/* Forward declarations */ /* Forward declarations */
static size_t xstrlcpy(char *dest, const char *src, size_t n);
static void redraw(char *path); static void redraw(char *path);
static int spawn(char *file, char *arg1, char *arg2, const char *dir, uchar flag); 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 int (*nftw_fn)(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf);
@ -794,8 +795,11 @@ static void printmsg(const char *msg)
static void printwait(const char *msg, int *presel) static void printwait(const char *msg, int *presel)
{ {
printmsg(msg); printmsg(msg);
if (presel) if (presel) {
*presel = MSGWAIT; *presel = MSGWAIT;
if (ndents)
xstrlcpy(g_ctx[cfg.curctx].c_name, dents[cur].name, NAME_MAX + 1);
}
} }
/* Kill curses and display error before exiting */ /* Kill curses and display error before exiting */
@ -3420,7 +3424,7 @@ static void save_session(bool last_session, int *presel)
fsession = fopen(spath, "wb"); fsession = fopen(spath, "wb");
if (!fsession) { if (!fsession) {
printwait(messages[MSG_ACCESS], presel); printwait(messages[MSG_SEL_MISSING], presel);
return; return;
} }
@ -3473,7 +3477,7 @@ static bool load_session(const char *sname, char **path, char **lastdir, char **
fsession = fopen(spath, "rb"); fsession = fopen(spath, "rb");
if (!fsession) { if (!fsession) {
printmsg(messages[MSG_ACCESS]); printmsg(messages[MSG_SEL_MISSING]);
xdelay(XDELAY_INTERVAL_MS); xdelay(XDELAY_INTERVAL_MS);
return FALSE; return FALSE;
} }
@ -3847,8 +3851,10 @@ static bool archive_mount(char *name, char *path, char *newpath, int *presel)
} }
dir = strdup(name); dir = strdup(name);
if (!dir) if (!dir) {
printwait(messages[MSG_FAILED], presel);
return FALSE; return FALSE;
}
len = strlen(dir); len = strlen(dir);
@ -5336,12 +5342,10 @@ nochange:
> DOUBLECLICK_INTERVAL_NS) > DOUBLECLICK_INTERVAL_NS)
break; break;
mousetimings[currentmouse].tv_sec = 0; mousetimings[currentmouse].tv_sec = 0;
} else { } else
if (cfg.filtermode) goto nochange;
presel = FILTER;
goto nochange; // fallthrough
}
#endif #endif
// fallthrough
case SEL_NAV_IN: // fallthrough case SEL_NAV_IN: // fallthrough
case SEL_GOIN: case SEL_GOIN:
/* Cannot descend in empty directories */ /* Cannot descend in empty directories */
@ -5457,10 +5461,9 @@ nochange:
setdirwatch(); setdirwatch();
goto begin; goto begin;
} else {
printwait(messages[MSG_FAILED], &presel);
goto nochange;
} }
goto nochange;
} }
if (r != 'd') { if (r != 'd') {
@ -5874,9 +5877,10 @@ nochange:
if (cfg.filtermode) if (cfg.filtermode)
presel = FILTER; presel = FILTER;
if (access(newpath, F_OK) == 0) /* File not removed */ if (access(newpath, F_OK) == 0) { /* File not removed */
copycurname();
goto nochange; goto nochange;
else if (cur) { } else if (cur) {
cur += (cur != (ndents - 1)) ? 1 : -1; cur += (cur != (ndents - 1)) ? 1 : -1;
copycurname(); copycurname();
} else } else
@ -6317,7 +6321,6 @@ nochange:
case SEL_TIMETYPE: case SEL_TIMETYPE:
if (!set_time_type(&presel)) if (!set_time_type(&presel))
goto nochange; goto nochange;
goto begin; goto begin;
default: default:
if (xlines != LINES || xcols != COLS) if (xlines != LINES || xcols != COLS)