]> Sergey Matveev's repositories - nnn.git/commitdiff
Show sort order if applied
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 1 Apr 2017 12:31:54 +0000 (18:01 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 1 Apr 2017 15:33:58 +0000 (21:03 +0530)
nnn.c

diff --git a/nnn.c b/nnn.c
index 81652a76f549c5ca4712a2926364ddef158d8902..4392efffcfc379dde24cd9e076613f2648751e98 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -702,25 +702,31 @@ redraw(char *path)
 
        if (showdetail) {
                if (ndents) {
-                       static char ind;
-                       ind = '\0';
+                       static char ind[2] = "\0\0";
+                       static char sort[9];
+
+                       if (mtimeorder)
+                               sprintf(sort, "by time ");
+                       else if (sizeorder)
+                               sprintf(sort, "by size ");
+                       else
+                               sort[0] = '\0';
 
                        if (S_ISDIR(dents[cur].mode))
-                               ind = '/';
+                               ind[0] = '/';
                        else if (S_ISLNK(dents[cur].mode))
-                               ind = '@';
+                               ind[0] = '@';
                        else if (S_ISSOCK(dents[cur].mode))
-                               ind = '=';
+                               ind[0] = '=';
                        else if (S_ISFIFO(dents[cur].mode))
-                               ind = '|';
+                               ind[0] = '|';
                        else if (dents[cur].mode & S_IXUSR)
-                               ind = '*';
-
-                       ind ? sprintf(cwd, "%d items [%s%c]",
-                                     ndents, dents[cur].name, ind)
-                           : sprintf(cwd, "%d items [%s]",
-                                     ndents, dents[cur].name);
+                               ind[0] = '*';
+                       else
+                               ind[0] = '\0';
 
+                       sprintf(cwd, "total %d %s[%s%s]", ndents, sort,
+                               dents[cur].name, ind);
                        printmsg(cwd);
                } else
                        printmsg("0 items");