Make NNN_COLORS override NO_COLORS (#515)

This commit is contained in:
lvgx 2020-04-13 18:51:56 +02:00 committed by GitHub
parent cd1c458c96
commit a6cef2504c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

2
nnn.1
View file

@ -417,7 +417,7 @@ separated by \fI;\fR:
\fBnnn:\fR this is a special variable set to the hovered entry before executing \fBnnn:\fR this is a special variable set to the hovered entry before executing
a command from the command prompt or spawning a shell. a command from the command prompt or spawning a shell.
.Pp .Pp
\fBNO_COLOR:\fR if defined, disable ANSI color output. \fBNO_COLOR:\fR disable ANSI color output (overridden by \fBNNN_COLORS\fR).
.Sh KNOWN ISSUES .Sh KNOWN ISSUES
.Nm .Nm
may not handle keypresses correctly when used with tmux (see issue #104 for may not handle keypresses correctly when used with tmux (see issue #104 for

View file

@ -1494,9 +1494,13 @@ static bool initcurses(void *oldmask)
#endif #endif
curs_set(FALSE); /* Hide cursor */ curs_set(FALSE); /* Hide cursor */
if (!getenv("NO_COLOR")) { char *colors = getenv(env_cfg[NNN_COLORS]);
if (colors || !getenv("NO_COLOR")) {
short i; short i;
char *colors = xgetenv(env_cfg[NNN_COLORS], "4444");
if (!colors)
colors = "4444";
start_color(); start_color();
use_default_colors(); use_default_colors();