mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Detect odd hex symbols in NNN_COLORS
This commit is contained in:
parent
8d94809897
commit
ccfccb7187
16
src/nnn.c
16
src/nnn.c
|
@ -1589,7 +1589,6 @@ static bool initcurses(void *oldmask)
|
||||||
|
|
||||||
if (colors || !getenv("NO_COLOR")) {
|
if (colors || !getenv("NO_COLOR")) {
|
||||||
uint *pcode;
|
uint *pcode;
|
||||||
char ch;
|
|
||||||
bool ext = FALSE;
|
bool ext = FALSE;
|
||||||
|
|
||||||
start_color();
|
start_color();
|
||||||
|
@ -1622,16 +1621,17 @@ static bool initcurses(void *oldmask)
|
||||||
|
|
||||||
if (colors && *colors) {
|
if (colors && *colors) {
|
||||||
if (ext) {
|
if (ext) {
|
||||||
ch = *colors;
|
*pcode = xchartohex(*colors) << 4;
|
||||||
if (*++colors) {
|
if (*++colors)
|
||||||
*pcode = (16 * xchartohex(ch)) + xchartohex(*colors);
|
*pcode += xchartohex(*colors);
|
||||||
++colors;
|
else { /* Each color code must be 2 hex symbols */
|
||||||
|
exitcurses();
|
||||||
|
fprintf(stderr, "NNN_COLORS!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
*pcode = xchartohex(ch);
|
|
||||||
} else {
|
|
||||||
*pcode = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
|
*pcode = (*colors < '0' || *colors > '7') ? 4 : *colors - '0';
|
||||||
++colors;
|
++colors;
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
*pcode = 4;
|
*pcode = 4;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue