From c22bf87f3e23d39a2df939c9079aa193b8b3c336 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 11 Jan 2020 00:55:23 +0530 Subject: [PATCH] Enable filter mode when there's a filter --- src/nnn.c | 23 +++++++++++------------ src/nnn.h | 6 +++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index a3b44c96..85fba686 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4806,8 +4806,8 @@ nochange: case SEL_BSIZE: // fallthrough case SEL_EXTN: // fallthrough case SEL_MTIME: // fallthrough - case SEL_VERSION: // fallthrough - case SEL_REVERSE: + case SEL_REVERSE: // fallthrough + case SEL_VERSION: if (sel >= SEL_FSIZE && sel < SEL_REVERSE && entrycmpfn == &reventrycmp) entrycmpfn = &entrycmp; @@ -4882,25 +4882,24 @@ nochange: cfg.blkorder = 0; cfg.extnorder = 0; break; - case SEL_VERSION: - namecmpfn = (namecmpfn == &xstrverscasecmp) ? &xstricmp : &xstrverscasecmp; - break; - default: /* SEL_REVERSE */ + case SEL_REVERSE: entrycmpfn = (entrycmpfn == &entrycmp) ? &reventrycmp : &entrycmp; break; + default: /* SEL_VERSION */ + namecmpfn = (namecmpfn == &xstrverscasecmp) ? &xstricmp : &xstrverscasecmp; + break; } - if (cfg.filtermode) - presel = FILTER; /* Save current */ if (ndents) copycurname(); - /* If there's no filter, reload the directory */ - if (!g_ctx[cfg.curctx].c_fltr[1]) - goto begin; - break; + if (cfg.filtermode || g_ctx[cfg.curctx].c_fltr[1]) { + presel = FILTER; + break; + } + goto begin; case SEL_STATS: // fallthrough case SEL_CHMODX: if (ndents) { diff --git a/src/nnn.h b/src/nnn.h index 98ce2793..e9fa838d 100644 --- a/src/nnn.h +++ b/src/nnn.h @@ -72,8 +72,8 @@ enum action { SEL_BSIZE, /* block size */ SEL_EXTN, /* order by extension */ SEL_MTIME, - SEL_VERSION, SEL_REVERSE, + SEL_VERSION, SEL_REDRAW, SEL_SEL, SEL_SELMUL, @@ -193,11 +193,11 @@ static struct key bindings[] = { { 'E', SEL_EXTN }, /* Toggle sort by time */ { 't', SEL_MTIME }, - /* Toggle version sort */ - { 'v', SEL_VERSION }, /* Toggle reverse sort */ { 'R', SEL_REVERSE }, { CONTROL('T'), SEL_REVERSE }, + /* Toggle version sort */ + { 'v', SEL_VERSION }, /* Redraw window */ { CONTROL('L'), SEL_REDRAW }, { KEY_F(5), SEL_REDRAW },