Bladeren bron

Dim links

master
Arun Prakash Jana 4 jaren geleden
bovenliggende
commit
f12bf0a2ee
Geen bekende sleutel gevonden voor deze handtekening in de database GPG sleutel-ID: A75979F35C080412
1 gewijzigde bestanden met toevoegingen van 26 en 27 verwijderingen
  1. +26
    -27
      src/nnn.c

+ 26
- 27
src/nnn.c Bestand weergeven

@@ -3142,13 +3142,11 @@ static char *get_lsperms(mode_t mode)


static void printent(const struct entry *ent, uint namecols, bool sel) static void printent(const struct entry *ent, uint namecols, bool sel)
{ {
char hln = '\0';
char ind = get_ind(ent->mode, FALSE); char ind = get_ind(ent->mode, FALSE);
int attrs = sel ? A_REVERSE : 0;


if (S_ISREG(ent->mode) && (ent->flags & HARD_LINK)) {
hln = '>';
--namecols;
}
if ((S_ISREG(ent->mode) && (ent->flags & HARD_LINK)) || ind == '@')
attrs |= A_DIM;


if (!ind) if (!ind)
++namecols; ++namecols;
@@ -3158,21 +3156,22 @@ static void printent(const struct entry *ent, uint namecols, bool sel)


addch((ent->flags & FILE_SELECTED) ? '+' : ' '); addch((ent->flags & FILE_SELECTED) ? '+' : ' ');


if (sel)
attron(A_REVERSE);
if (attrs)
attron(attrs);
addwstr(unescape(ent->name, namecols)); addwstr(unescape(ent->name, namecols));
if (sel)
attroff(A_REVERSE);
if (attrs)
attroff(attrs);

if (ind) if (ind)
addch(ind); addch(ind);
if (hln)
addch(hln);
addch('\n'); addch('\n');
} }


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[18], permbuf[8], ind1 = '\0', ind2 = '\0', special = '\0';
bool ln = FALSE;
char timebuf[18], permbuf[8], ind1 = '\0', ind2 = '\0';
int attrs = sel ? A_REVERSE : 0;
size_t len; size_t len;
char *size; char *size;


@@ -3192,25 +3191,23 @@ static void printent_long(const struct entry *ent, uint namecols, bool sel)


addch((ent->flags & FILE_SELECTED) ? '+' : ' '); addch((ent->flags & FILE_SELECTED) ? '+' : ' ');


if (sel)
attron(A_REVERSE);
if (attrs)
attron(attrs);


addstr(timebuf); addstr(timebuf);
addstr(permbuf); addstr(permbuf);


switch (ent->mode & S_IFMT) { switch (ent->mode & S_IFMT) {
case S_IFREG: case S_IFREG:
ind1 = (ent->flags & HARD_LINK) ? '>' : ' ';
if (ent->flags & HARD_LINK)
ln = TRUE;

if (ent->mode & 0100) if (ent->mode & 0100)
ind2 = '*'; ind2 = '*';
else /* Add a column if no indicator is needed */
++namecols;
// fallthrough // fallthrough
case S_IFDIR: case S_IFDIR:
if (!ind1) {
ind1 = ' ';
if (!ind2) /* Add a column if end indicator is not needed */
++namecols; ++namecols;
}


size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size); size = coolsize(cfg.blkorder ? ent->blocks << blk_shift : ent->size);
len = 9 - strlen(size); len = 9 - strlen(size);
@@ -3219,6 +3216,7 @@ static void printent_long(const struct entry *ent, uint namecols, bool sel)
addstr(size); addstr(size);
break; break;
case S_IFLNK: case S_IFLNK:
ln = TRUE;
ind1 = ind2 = '@'; // fallthrough ind1 = ind2 = '@'; // fallthrough
case S_IFSOCK: case S_IFSOCK:
if (!ind1) if (!ind1)
@@ -3236,17 +3234,18 @@ static void printent_long(const struct entry *ent, uint namecols, bool sel)
if (!ind1) if (!ind1)
ind1 = ind2 = '?'; ind1 = ind2 = '?';
addstr(" "); addstr(" ");
special = ' ';
addch(ind1);
break; break;
} }


addch(ind1);
addch(' ');
if (special)
addch(special);
addstr(" ");
if (ln) {
attron(A_DIM);
attrs |= A_DIM;
}
addwstr(unescape(ent->name, namecols)); addwstr(unescape(ent->name, namecols));
if (sel)
attroff(A_REVERSE);
if (attrs)
attroff(attrs);
if (ind2) if (ind2)
addch(ind2); addch(ind2);
addch('\n'); addch('\n');


Laden…
Annuleren
Opslaan