From c275c5158e18cb132e5a74c99b309aaf5af1e0c3 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 9 Jun 2020 13:41:46 +0200 Subject: [PATCH] rcfile: introduce the modifier "bold", for specifying bolding separately This makes it possible to avoid the misnamed prefix "bright". It is misnamed because (on current terminal emulators, when the brightening of bold is switched off) it just makes the typeface bold, not the color brighter. The prefix "light" will now only make the color brigther, and the modifier "bold" will just make the typeface bold (on terminal emulators, when the brightening of bold is switched off). On a Linux console, which is not capable of bolding the typeface, "bold" will brighten the color. This fully fulfills https://savannah.gnu.org/bugs/?58503. --- src/rcfile.c | 12 +++++++++++- syntax/nanorc.nanorc | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/rcfile.c b/src/rcfile.c index 1e27f164..7f5fb138 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1029,6 +1029,16 @@ bool parse_combination(char *combostr, short *fg, short *bg, int *attributes) *attributes = A_NORMAL; + if (strncmp(combostr, "bold", 4) == 0) { + *attributes = A_BOLD; + if (combostr[4] != ',') { + jot_error(N_("An attribute requires a subsequent comma")); + return FALSE; + } + combostr += 5; + comma = strchr(combostr, ','); + } + if (comma != NULL) { *bg = color_to_short(comma + 1, &vivid, &thick); if (vivid && thick) { @@ -1050,7 +1060,7 @@ bool parse_combination(char *combostr, short *fg, short *bg, int *attributes) if (vivid && !thick && COLORS > 8) *fg += 8; else if (vivid) - *attributes = A_BOLD; + *attributes |= A_BOLD; } else *fg = USE_THE_DEFAULT; diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index fcc96a4b..ba132df3 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -21,7 +21,7 @@ color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|f color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)" # Colors -color yellow "^[[:space:]]*i?color[[:space:]]*(bright|light)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(light)?(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>" +color yellow "^[[:space:]]*i?color[[:space:]]*(bright|(bold,)?(light)?)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(light)?(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>" color magenta "^[[:space:]]*i?color\>" "\<(start|end)=" # Comments