Browse Source

Show order info in filter info bar

master
Arun Prakash Jana 4 years ago
parent
commit
364399246e
No known key found for this signature in database GPG Key ID: A75979F35C080412
2 changed files with 40 additions and 27 deletions
  1. +2
    -1
      README.md
  2. +38
    -26
      src/nnn.c

+ 2
- 1
README.md View File

@@ -26,11 +26,12 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
## Features

- Resource sensitive
- Typically needs < 3.5MB resident memory
- Typically needs less than 3.5MB resident memory
- Works with 8-bit colors
- Disk-IO sensitive (few disk reads and writes)
- No FPU usage (all integer maths, even for file size)
- Minimizes screen refresh with fast line redraws
- Tiny binary (typically less than 100KB)
- Portable
- Minimal library deps, easily compilable, tiny binary
- No config file, minimal config with sensible defaults


+ 38
- 26
src/nnn.c View File

@@ -2028,11 +2028,44 @@ static int nextsel(int presel)
return 0;
}

static int getorderstr(char *sort)
{
int i = 0;

if (cfg.mtimeorder)
sort[0] = cfg.mtime ? 'T' : 'A';
else if (cfg.sizeorder)
sort[0] = 'S';
else if (cfg.extnorder)
sort[0] = 'E';

if (sort[i])
++i;

if (entrycmpfn == &reventrycmp) {
sort[i] = 'R';
++i;
}

if (namecmpfn == &xstrverscasecmp) {
sort[i] = 'V';
++i;
}

if (i)
sort[i] = ' ';

return i;
}

static void showfilterinfo(void)
{
char info[REGEX_MAX];
int i = 0;
char info[REGEX_MAX] = "\0\0\0\0";

snprintf(info, REGEX_MAX - 1, " %s [keys /\\], %s [key :]",
i = getorderstr(info);

snprintf(info + i, REGEX_MAX - i - 1, " %s [keys /\\], %s [key :]",
(cfg.regex ? "regex" : "str"),
((fnstrstr == &strcasestr) ? "ic" : "noic"));
printinfoln(info);
@@ -4230,7 +4263,6 @@ static void statusbar(char *path)
{
int i = 0, extnlen = 0;
char *ptr;
char sort[] = "\0\0\0\0";
char buf[24];
pEntry pent = &dents[cur];

@@ -4239,29 +4271,6 @@ static void statusbar(char *path)
return;
}

if (cfg.mtimeorder)
sort[0] = cfg.mtime ? 'T' : 'A';
else if (cfg.sizeorder)
sort[0] = 'S';
else if (cfg.extnorder)
sort[0] = 'E';

if (sort[i])
++i;

if (entrycmpfn == &reventrycmp) {
sort[i] = 'R';
++i;
}

if (namecmpfn == &xstrverscasecmp) {
sort[i] = 'V';
++i;
}

if (i)
sort[i] = ' ';

/* Get the file extension for regular files */
if (S_ISREG(pent->mode)) {
i = (int)(pent->nlen - 1);
@@ -4287,6 +4296,9 @@ static void statusbar(char *path)
/* Show filename as it may be truncated in directory listing */
/* Get the unescaped file name */
char *fname = unescape(pent->name, NAME_MAX, NULL);
char sort[] = "\0\0\0\0";

getorderstr(sort);

/* Timestamp */
strftime(buf, sizeof(buf), "%F %R", localtime(&pent->t));


Loading…
Cancel
Save