mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Fix invisible details when color code is 0
This commit is contained in:
parent
e5c1b0bdd2
commit
f3fe27e694
32
src/nnn.c
32
src/nnn.c
|
@ -3404,6 +3404,7 @@ static char *get_kv_val(kv *kvarr, char *buf, int key, uchar_t max, uchar_t id)
|
||||||
|
|
||||||
static void resetdircolor(int flags)
|
static void resetdircolor(int flags)
|
||||||
{
|
{
|
||||||
|
/* Directories are always shown on top, clear the color when moving to first file */
|
||||||
if (g_state.dircolor && !(flags & DIR_OR_LINK_TO_DIR)) {
|
if (g_state.dircolor && !(flags & DIR_OR_LINK_TO_DIR)) {
|
||||||
attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
|
attroff(COLOR_PAIR(cfg.curctx + 1) | A_BOLD);
|
||||||
g_state.dircolor = 0;
|
g_state.dircolor = 0;
|
||||||
|
@ -3725,10 +3726,9 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||||
|
|
||||||
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE : ' ');
|
addch((ent->flags & FILE_SELECTED) ? '+' | A_REVERSE : ' ');
|
||||||
|
|
||||||
/* Directories are always shown on top */
|
if (g_state.oldcolor)
|
||||||
resetdircolor(ent->flags);
|
resetdircolor(ent->flags);
|
||||||
|
else {
|
||||||
if (!g_state.oldcolor) {
|
|
||||||
if (ent->flags & FILE_MISSING)
|
if (ent->flags & FILE_MISSING)
|
||||||
color_pair = C_MIS;
|
color_pair = C_MIS;
|
||||||
if (color_pair && fcolors[color_pair])
|
if (color_pair && fcolors[color_pair])
|
||||||
|
@ -3758,15 +3758,21 @@ static void printent(const struct entry *ent, uint_t namecols, bool sel)
|
||||||
addch('\n');
|
addch('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_details(const struct entry *ent)
|
/* For the usage of comma operator in C, visit https://en.wikipedia.org/wiki/Comma_operator */
|
||||||
|
static void printent_long(const struct entry *ent, uint_t namecols, bool sel)
|
||||||
{
|
{
|
||||||
|
int attrs = g_state.oldcolor ? (resetdircolor(ent->flags), A_DIM)
|
||||||
|
: (fcolors[C_MIS] ? COLOR_PAIR(C_MIS) : 0);
|
||||||
int entry_type = ent->mode & S_IFMT;
|
int entry_type = ent->mode & S_IFMT;
|
||||||
char perms[6] = {' ', ' ', (char)('0' + ((ent->mode >> 6) & 7)),
|
char perms[6] = {' ', ' ', (char)('0' + ((ent->mode >> 6) & 7)),
|
||||||
(char)('0' + ((ent->mode >> 3) & 7)), (char)('0' + (ent->mode & 7)), '\0'};
|
(char)('0' + ((ent->mode >> 3) & 7)), (char)('0' + (ent->mode & 7)), '\0'};
|
||||||
|
|
||||||
/* Directories are always shown on top */
|
addch(sel ? ' ' | A_REVERSE : ' '); /* Reversed block for hovered entry */
|
||||||
resetdircolor(ent->flags);
|
|
||||||
|
|
||||||
|
if (attrs)
|
||||||
|
attron(attrs);
|
||||||
|
|
||||||
|
/* Print details */
|
||||||
print_time(&ent->sec);
|
print_time(&ent->sec);
|
||||||
addstr(perms);
|
addstr(perms);
|
||||||
|
|
||||||
|
@ -3776,17 +3782,9 @@ static void print_details(const struct entry *ent)
|
||||||
printw("%*c%s ", 9 - (uint_t)xstrlen(size), ' ', size);
|
printw("%*c%s ", 9 - (uint_t)xstrlen(size), ' ', size);
|
||||||
} else
|
} else
|
||||||
printw("%*c%c ", 8, ' ', get_detail_ind(ent->mode));
|
printw("%*c%c ", 8, ' ', get_detail_ind(ent->mode));
|
||||||
}
|
|
||||||
|
|
||||||
static void printent_long(const struct entry *ent, uint_t namecols, bool sel)
|
if (attrs)
|
||||||
{
|
attroff(attrs);
|
||||||
int attrs1 = g_state.oldcolor ? A_DIM : COLOR_PAIR(C_MIS);
|
|
||||||
|
|
||||||
addch(sel ? ' ' | A_REVERSE : ' '); /* Reversed block for hovered entry */
|
|
||||||
|
|
||||||
attron(attrs1);
|
|
||||||
print_details(ent);
|
|
||||||
attroff(attrs1);
|
|
||||||
|
|
||||||
printent(ent, namecols, sel);
|
printent(ent, namecols, sel);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue