]> Sergey Matveev's repositories - nnn.git/commitdiff
Enable filter mode when there's a filter
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 10 Jan 2020 19:25:23 +0000 (00:55 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 10 Jan 2020 19:25:23 +0000 (00:55 +0530)
src/nnn.c
src/nnn.h

index a3b44c967801cdc48bebb1c736d764a4a5a5de6c..85fba686fb3eea5562a7848b7aca37dd6b3e34ef 100644 (file)
--- 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) {
index 98ce27935b17a767aa91d0b9346e991fe53ad257..e9fa838d3eadd9c1246a44ab2735edef5f526022 100644 (file)
--- 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 },