basic/terminal-util: rename our replacement highlight-yellow and test both the original and replacement

The fact that we cannot use the "real" yellow color and need to use some other
color is essentially a bug. In this particular case the issue is in urxvt, see
a9009769de. While we work around this by using a
different color, let's not forget that this is just a (hopefullly temporary)
workaround.

https://bugzilla.redhat.com/show_bug.cgi?id=1859886
https://bugzilla.redhat.com/show_bug.cgi?id=1859889
https://bugzilla.redhat.com/show_bug.cgi?id=1859894
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-07-30 14:43:02 +02:00
parent 37873ebfbc
commit 5ee27251cd
2 changed files with 19 additions and 11 deletions
+17 -10
View File
@@ -33,16 +33,19 @@
#define ANSI_GREY "\x1B[0;38;5;245m"
/* Bold/highlighted */
#define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m"
#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;38;5;185m"
#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m"
#define ANSI_HIGHLIGHT_CYAN "\x1B[0;1;36m"
#define ANSI_HIGHLIGHT_WHITE "\x1B[0;1;37m"
#define ANSI_HIGHLIGHT_GREY "\x1B[0;1;38;5;245m"
#define ANSI_HIGHLIGHT_YELLOW4 "\x1B[0;1;38;5;100m"
#define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m"
#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
#define _ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m" /* This yellow is currently not displayed well by some terminals */
#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
#define ANSI_HIGHLIGHT_MAGENTA "\x1B[0;1;35m"
#define ANSI_HIGHLIGHT_CYAN "\x1B[0;1;36m"
#define ANSI_HIGHLIGHT_WHITE "\x1B[0;1;37m"
#define ANSI_HIGHLIGHT_YELLOW4 "\x1B[0;1;38;5;100m"
#define ANSI_HIGHLIGHT_KHAKI3 "\x1B[0;1;38;5;185m"
#define ANSI_HIGHLIGHT_GREY "\x1B[0;1;38;5;245m"
#define ANSI_HIGHLIGHT_YELLOW ANSI_HIGHLIGHT_KHAKI3 /* Replacement yellow that is more legible */
/* Underlined */
#define ANSI_GREY_UNDERLINE "\x1B[0;4;38;5;245m"
@@ -170,6 +173,10 @@ DEFINE_ANSI_FUNC(highlight_cyan, HIGHLIGHT_CYAN);
DEFINE_ANSI_FUNC(highlight_grey, HIGHLIGHT_GREY);
DEFINE_ANSI_FUNC(highlight_white, HIGHLIGHT_WHITE);
static inline const char* _ansi_highlight_yellow(void) {
return colors_enabled() ? _ANSI_HIGHLIGHT_YELLOW : "";
}
DEFINE_ANSI_FUNC_UNDERLINE(underline, UNDERLINE, NORMAL);
DEFINE_ANSI_FUNC_UNDERLINE(highlight_underline, HIGHLIGHT_UNDERLINE, HIGHLIGHT);
DEFINE_ANSI_FUNC_UNDERLINE(grey_underline, GREY_UNDERLINE, GREY);
+2 -1
View File
@@ -111,7 +111,8 @@ static const Color colors[] = {
{ "highlight-black", ansi_highlight_black },
{ "highlight-red", ansi_highlight_red },
{ "highlight-green", ansi_highlight_green },
{ "highlight-yellow", ansi_highlight_yellow },
{ "highlight-yellow (original)", _ansi_highlight_yellow },
{ "highlight-yellow (replacement)", ansi_highlight_yellow },
{ "highlight-blue", ansi_highlight_blue },
{ "highlight-magenta", ansi_highlight_magenta },
{ "highlight-cyan", ansi_highlight_cyan },