Enable filter mode when there's a filter

This commit is contained in:
Arun Prakash Jana 2020-01-11 00:55:23 +05:30
parent 38414f4349
commit c22bf87f3e
No known key found for this signature in database
GPG key ID: A75979F35C080412
2 changed files with 14 additions and 15 deletions

View file

@ -4806,8 +4806,8 @@ nochange:
case SEL_BSIZE: // fallthrough case SEL_BSIZE: // fallthrough
case SEL_EXTN: // fallthrough case SEL_EXTN: // fallthrough
case SEL_MTIME: // fallthrough case SEL_MTIME: // fallthrough
case SEL_VERSION: // fallthrough case SEL_REVERSE: // fallthrough
case SEL_REVERSE: case SEL_VERSION:
if (sel >= SEL_FSIZE && sel < SEL_REVERSE && entrycmpfn == &reventrycmp) if (sel >= SEL_FSIZE && sel < SEL_REVERSE && entrycmpfn == &reventrycmp)
entrycmpfn = &entrycmp; entrycmpfn = &entrycmp;
@ -4882,25 +4882,24 @@ nochange:
cfg.blkorder = 0; cfg.blkorder = 0;
cfg.extnorder = 0; cfg.extnorder = 0;
break; break;
case SEL_VERSION: case SEL_REVERSE:
namecmpfn = (namecmpfn == &xstrverscasecmp) ? &xstricmp : &xstrverscasecmp;
break;
default: /* SEL_REVERSE */
entrycmpfn = (entrycmpfn == &entrycmp) ? &reventrycmp : &entrycmp; entrycmpfn = (entrycmpfn == &entrycmp) ? &reventrycmp : &entrycmp;
break; break;
default: /* SEL_VERSION */
namecmpfn = (namecmpfn == &xstrverscasecmp) ? &xstricmp : &xstrverscasecmp;
break;
} }
if (cfg.filtermode)
presel = FILTER;
/* Save current */ /* Save current */
if (ndents) if (ndents)
copycurname(); copycurname();
/* If there's no filter, reload the directory */ if (cfg.filtermode || g_ctx[cfg.curctx].c_fltr[1]) {
if (!g_ctx[cfg.curctx].c_fltr[1]) presel = FILTER;
goto begin; break;
break; }
goto begin;
case SEL_STATS: // fallthrough case SEL_STATS: // fallthrough
case SEL_CHMODX: case SEL_CHMODX:
if (ndents) { if (ndents) {

View file

@ -72,8 +72,8 @@ enum action {
SEL_BSIZE, /* block size */ SEL_BSIZE, /* block size */
SEL_EXTN, /* order by extension */ SEL_EXTN, /* order by extension */
SEL_MTIME, SEL_MTIME,
SEL_VERSION,
SEL_REVERSE, SEL_REVERSE,
SEL_VERSION,
SEL_REDRAW, SEL_REDRAW,
SEL_SEL, SEL_SEL,
SEL_SELMUL, SEL_SELMUL,
@ -193,11 +193,11 @@ static struct key bindings[] = {
{ 'E', SEL_EXTN }, { 'E', SEL_EXTN },
/* Toggle sort by time */ /* Toggle sort by time */
{ 't', SEL_MTIME }, { 't', SEL_MTIME },
/* Toggle version sort */
{ 'v', SEL_VERSION },
/* Toggle reverse sort */ /* Toggle reverse sort */
{ 'R', SEL_REVERSE }, { 'R', SEL_REVERSE },
{ CONTROL('T'), SEL_REVERSE }, { CONTROL('T'), SEL_REVERSE },
/* Toggle version sort */
{ 'v', SEL_VERSION },
/* Redraw window */ /* Redraw window */
{ CONTROL('L'), SEL_REDRAW }, { CONTROL('L'), SEL_REDRAW },
{ KEY_F(5), SEL_REDRAW }, { KEY_F(5), SEL_REDRAW },