mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 03:41:27 +00:00
Show order info in filter info bar
This commit is contained in:
parent
1b252b6ecb
commit
364399246e
|
@ -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
|
||||
|
|
64
src/nnn.c
64
src/nnn.c
|
@ -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…
Reference in a new issue