Selaa lähdekoodia

Revert "Reduce processing if NNN_COLORS is unset"

This reverts commit b948423a80.
master
Arun Prakash Jana 4 vuotta sitten
vanhempi
commit
b3f2e47173
1 muutettua tiedostoa jossa 36 lisäystä ja 38 poistoa
  1. +36
    -38
      src/nnn.c

+ 36
- 38
src/nnn.c Näytä tiedosto

@@ -1586,56 +1586,54 @@ static bool initcurses(void *oldmask)
char *colors = getenv(env_cfg[NNN_COLORS]); char *colors = getenv(env_cfg[NNN_COLORS]);


if (colors || !getenv("NO_COLOR")) { if (colors || !getenv("NO_COLOR")) {
uint *pclr; uint *pcode;
char ch; char ch;
bool ext = FALSE; bool ext = FALSE;


start_color(); start_color();
use_default_colors(); use_default_colors();


if (colors) { if (colors && *colors == '#') {
if (*colors == '#') { char *sep = strchr(colors, ';');
char *sep = strchr(colors, ';');


if (COLORS >= 256) { if (COLORS >= 256) {
++colors; ++colors;
ext = TRUE; ext = TRUE;


/* /*
* If fallback colors are specified, set the separator * If fallback colors are specified, set the separator
* to NULL so we don't interpret separator and fallback * to NULL so we don't interpret separator and fallback
* if fewer than CTX_MAX xterm 256 colors are specified. * if fewer than CTX_MAX xterm 256 colors are specified.
*/ */
if (sep) if (sep)
*sep = '\0'; *sep = '\0';
} else { } else {
colors = sep; /* Detect if 8 colors fallback is appended */ colors = sep; /* Detect if 8 colors fallback is appended */
if (colors) if (colors)
++colors; ++colors;
}
} }
}


/* Get and set the context colors */ /* Get and set the context colors */
for (uchar i = 0; i < CTX_MAX; ++i) { for (uchar i = 0; i < CTX_MAX; ++i) {
pclr = &g_ctx[i].color; pcode = &g_ctx[i].color;

if (colors && *colors) {
if (*colors) { if (ext) {
if (ext) { ch = *colors;
ch = *colors; if (*++colors) {
if (*++colors) { *pcode = (16 * xchartohex(ch)) + xchartohex(*colors);
*pclr = (16 * xchartohex(ch)) + xchartohex(*colors);
++colors;
} else
*pclr = xchartohex(ch);
} else {
*pclr = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
++colors; ++colors;
} } else
} else *pcode = xchartohex(ch);
*pclr = 4; } else {
*pcode = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
++colors;
}
} else
*pcode = 4;


init_pair(i + 1, *pclr, -1); init_pair(i + 1, *pcode, -1);
}
} }
} }




||||||
x
 
000:0
Loading…
Peruuta
Tallenna