mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Simplify detail print
This commit is contained in:
parent
d0930d0ccf
commit
f61323cccd
34
src/nnn.c
34
src/nnn.c
|
@ -3207,7 +3207,7 @@ static void printent(const struct entry *ent, uint namecols, bool sel)
|
||||||
|
|
||||||
static void printent_long(const struct entry *ent, uint namecols, bool sel)
|
static void printent_long(const struct entry *ent, uint namecols, bool sel)
|
||||||
{
|
{
|
||||||
char timebuf[24], permbuf[4], ind1 = '\0', ind2[] = "\0\0";
|
char timebuf[24], permbuf[4], ind1 = '\0', ind2 = '\0';
|
||||||
const char cp = (ent->flags & FILE_SELECTED) ? '+' : ' ';
|
const char cp = (ent->flags & FILE_SELECTED) ? '+' : ' ';
|
||||||
|
|
||||||
/* Timestamp */
|
/* Timestamp */
|
||||||
|
@ -3235,23 +3235,27 @@ static void printent_long(const struct entry *ent, uint namecols, bool sel)
|
||||||
|
|
||||||
switch (ent->mode & S_IFMT) {
|
switch (ent->mode & S_IFMT) {
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
printw("%c%-16.16s %s %8.8s%s %s%s\n", cp, timebuf, permbuf,
|
ind1 = (ent->flags & HARD_LINK) ? '>' : ' ';
|
||||||
coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size),
|
if (ent->mode & 0100)
|
||||||
((ent->flags & HARD_LINK) ? ">" : " "), pname,
|
ind2 = '*'; // fallthrough
|
||||||
((ent->mode & 0100) ? "*" : ""));
|
|
||||||
break;
|
|
||||||
case S_IFDIR:
|
case S_IFDIR:
|
||||||
printw("%c%-16.16s %s %8.8s %s/\n", cp, timebuf, permbuf,
|
if (!ind1) {
|
||||||
coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size), pname);
|
ind1 = ' ';
|
||||||
|
ind2 = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
printw("%c%-16.16s %s %8.8s%c %s%c", cp, timebuf, permbuf,
|
||||||
|
coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size),
|
||||||
|
ind1, pname, ind2);
|
||||||
break;
|
break;
|
||||||
case S_IFLNK:
|
case S_IFLNK:
|
||||||
printw("%c%-16.16s %s @ %s@\n", cp, timebuf, permbuf, pname);
|
ind1 = ind2 = '@'; // fallthrough
|
||||||
break;
|
|
||||||
case S_IFSOCK:
|
case S_IFSOCK:
|
||||||
ind1 = ind2[0] = '='; // fallthrough
|
if (!ind1)
|
||||||
|
ind1 = ind2 = '='; // fallthrough
|
||||||
case S_IFIFO:
|
case S_IFIFO:
|
||||||
if (!ind1)
|
if (!ind1)
|
||||||
ind1 = ind2[0] = '|'; // fallthrough
|
ind1 = ind2 = '|'; // fallthrough
|
||||||
case S_IFBLK:
|
case S_IFBLK:
|
||||||
if (!ind1)
|
if (!ind1)
|
||||||
ind1 = 'b'; // fallthrough
|
ind1 = 'b'; // fallthrough
|
||||||
|
@ -3260,11 +3264,13 @@ static void printent_long(const struct entry *ent, uint namecols, bool sel)
|
||||||
ind1 = 'c'; // fallthrough
|
ind1 = 'c'; // fallthrough
|
||||||
default:
|
default:
|
||||||
if (!ind1)
|
if (!ind1)
|
||||||
ind1 = ind2[0] = '?';
|
ind1 = ind2 = '?';
|
||||||
printw("%c%-16.16s %s %c %s%s\n", cp, timebuf, permbuf, ind1, pname, ind2);
|
printw("%c%-16.16s %s %c %s%c", cp, timebuf, permbuf, ind1, pname, ind2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addch('\n');
|
||||||
|
|
||||||
if (sel)
|
if (sel)
|
||||||
attroff(A_REVERSE);
|
attroff(A_REVERSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue