diff options
| author | 2017-04-01 18:01:54 +0530 | |
|---|---|---|
| committer | 2017-04-01 21:03:58 +0530 | |
| commit | 6e7aaa18fbee0cbb669d3d00a1117bbe3a7b3014 (patch) | |
| tree | f7a976c4cc6f2a1b821bf4b3c4ec27c7f1c85d71 | |
| parent | 8f18c4049cccd4a01353e5a5c09ea05061c8d0a3 (diff) | |
| download | nnn-6e7aaa18fbee0cbb669d3d00a1117bbe3a7b3014.tar.gz | |
Show sort order if applied
| -rw-r--r-- | nnn.c | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -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"); |