]> Sergey Matveev's repositories - nnn.git/commitdiff
Make NNN_COLORS override NO_COLORS (#515)
authorlvgx <l@vgx.fr>
Mon, 13 Apr 2020 16:51:56 +0000 (18:51 +0200)
committerGitHub <noreply@github.com>
Mon, 13 Apr 2020 16:51:56 +0000 (22:21 +0530)
nnn.1
src/nnn.c

diff --git a/nnn.1 b/nnn.1
index 6b5ff0a5c27028fef57f40c83e4e2787fe8a724b..c424b469f645ed0f12cf44a3f88eea2ae8ca9d6e 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -417,7 +417,7 @@ separated by \fI;\fR:
 \fBnnn:\fR this is a special variable set to the hovered entry before executing
 a command from the command prompt or spawning a shell.
 .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
 .Nm
 may not handle keypresses correctly when used with tmux (see issue #104 for
index 3233acb1dca093864383978c4251540f70a2b00b..d8a2aa6583cdce9e067723dfe257e3b6f5579a40 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1494,9 +1494,13 @@ static bool initcurses(void *oldmask)
 #endif
        curs_set(FALSE); /* Hide cursor */
 
-       if (!getenv("NO_COLOR")) {
+       char *colors = getenv(env_cfg[NNN_COLORS]);
+
+       if (colors || !getenv("NO_COLOR")) {
                short i;
-               char *colors = xgetenv(env_cfg[NNN_COLORS], "4444");
+
+               if (!colors)
+                       colors = "4444";
 
                start_color();
                use_default_colors();