Revert "Reduce processing if NNN_COLORS is unset"

This reverts commit b948423a80.
This commit is contained in:
Arun Prakash Jana 2020-08-02 23:18:13 +05:30
parent b948423a80
commit b3f2e47173
1 changed files with 36 additions and 38 deletions

View File

@ -1586,15 +1586,14 @@ static bool initcurses(void *oldmask)
char *colors = getenv(env_cfg[NNN_COLORS]);
if (colors || !getenv("NO_COLOR")) {
uint *pclr;
uint *pcode;
char ch;
bool ext = FALSE;
start_color();
use_default_colors();
if (colors) {
if (*colors == '#') {
if (colors && *colors == '#') {
char *sep = strchr(colors, ';');
if (COLORS >= 256) {
@ -1617,25 +1616,24 @@ static bool initcurses(void *oldmask)
/* Get and set the context colors */
for (uchar i = 0; i < CTX_MAX; ++i) {
pclr = &g_ctx[i].color;
pcode = &g_ctx[i].color;
if (*colors) {
if (colors && *colors) {
if (ext) {
ch = *colors;
if (*++colors) {
*pclr = (16 * xchartohex(ch)) + xchartohex(*colors);
*pcode = (16 * xchartohex(ch)) + xchartohex(*colors);
++colors;
} else
*pclr = xchartohex(ch);
*pcode = xchartohex(ch);
} else {
*pclr = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
*pcode = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
++colors;
}
} else
*pclr = 4;
*pcode = 4;
init_pair(i + 1, *pclr, -1);
}
init_pair(i + 1, *pcode, -1);
}
}