>From de89bf2966f7df67356b1b68d4176c9af258db22 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 6 Jan 2018 12:01:05 +0100 Subject: [PATCH] color: translate 'bright' to a different color when not on a console --- src/nano.c | 10 +++++----- src/rcfile.c | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/nano.c b/src/nano.c index 7a8caf86..64e523a8 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1980,6 +1980,11 @@ int main(int argc, char **argv) {NULL, 0, NULL, 0} }; +#ifdef __linux__ + /* Check whether we're running on a Linux console. */ + console = (getenv("DISPLAY") == NULL); +#endif + /* Back up the terminal settings so that they can be restored. */ tcgetattr(0, &oldterm); @@ -2471,11 +2476,6 @@ int main(int argc, char **argv) /* Set up the terminal state. */ terminal_init(); -#ifdef __linux__ - /* Check whether we're running on a Linux console. */ - console = (getenv("DISPLAY") == NULL); -#endif - #ifdef DEBUG fprintf(stderr, "Main: set up windows\n"); #endif diff --git a/src/rcfile.c b/src/rcfile.c index eec65440..4947a28e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -768,6 +768,11 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright) /* If the specified foreground color is bad, ignore the regexes. */ if (*fg == -1) return FALSE; + + if (*bright && !console) { + *fg += 8; + *bright = FALSE; + } } else *fg = -1; -- 2.14.3