Quicker re-sort

This commit is contained in:
Arun Prakash Jana 2020-03-31 02:32:13 +05:30
parent eea1b5da7d
commit 2d27902ac0
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 16 additions and 14 deletions

View File

@ -692,6 +692,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);
@ -797,8 +798,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 */
@ -2307,8 +2311,8 @@ static int nextsel(int presel)
//DPRINTF_D(c); //DPRINTF_D(c);
//DPRINTF_S(keyname(c)); //DPRINTF_S(keyname(c));
if (c == ERR) if (c == ERR && presel == MSGWAIT)
c = 0; c = (cfg.filtermode || filterset()) ? FILTER : CONTROL('L');
else if (c == FILTER || c == CONTROL('L')) else if (c == FILTER || c == CONTROL('L'))
/* Clear previous filter when manually starting */ /* Clear previous filter when manually starting */
clearfilter(); clearfilter();
@ -5238,11 +5242,8 @@ nochange:
} }
sel = nextsel(presel); sel = nextsel(presel);
if (presel) { if (presel)
if (presel == MSGWAIT)
statusbar(path);
presel = 0; presel = 0;
}
switch (sel) { switch (sel) {
#ifndef NOMOUSE #ifndef NOMOUSE
@ -5657,17 +5658,18 @@ nochange:
} }
} }
/* Save current */
if (ndents)
copycurname();
if (cfg.filtermode || filterset()) if (cfg.filtermode || filterset())
presel = FILTER; presel = FILTER;
if (r == 'd' || r == 'a') if (ndents) {
goto begin; 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; continue;
case SEL_STATS: // fallthrough case SEL_STATS: // fallthrough
case SEL_CHMODX: case SEL_CHMODX: