core: fix decoding of attributes in basic ANSI colors (closes #1678)

This commit is contained in:
Sébastien Helleu 2021-08-06 20:33:31 +02:00
parent 79d50837c9
commit 20866a0457
4 changed files with 12 additions and 7 deletions

View File

@ -39,6 +39,7 @@ New features::
Bug fixes::
* core: fix decoding of attributes in basic ANSI colors (issue #1678)
* api: fix function string_match with joker in the string if multiple words matched in input string
* irc: fix SASL authentication when AUTHENTICATE message is received with a server name (issue #1679)
* irc: remove unneeded message about Diffie-Hellman shared secret exchange during SSL connection to server (issue #857)

View File

@ -1036,8 +1036,10 @@ gui_color_decode_ansi_cb (void *data, const char *text)
case 35:
case 36:
case 37:
strcat (output,
gui_color_get_custom (gui_color_ansi[value - 30]));
snprintf (str_color, sizeof (str_color),
"|%s",
gui_color_ansi[value - 30]);
strcat (output, gui_color_get_custom (str_color));
break;
case 38: /* text color */
if (i + 1 < num_items)
@ -1128,8 +1130,10 @@ gui_color_decode_ansi_cb (void *data, const char *text)
case 95:
case 96:
case 97:
strcat (output,
gui_color_get_custom (gui_color_ansi[value - 90 + 8]));
snprintf (str_color, sizeof (str_color),
"|%s",
gui_color_ansi[value - 90 + 8]);
strcat (output, gui_color_get_custom (str_color));
break;
case 100: /* background color (bright) */
case 101:

View File

@ -677,7 +677,7 @@ TEST(CoreEval, EvalExpression)
"${modifier:color_decode_ansi,0,test_\x1B[92mno_color}");
snprintf (str_value, sizeof (str_value),
"test_%slightgreen",
gui_color_get_custom ("lightgreen"));
gui_color_get_custom ("|lightgreen"));
WEE_CHECK_EVAL(str_value,
"${modifier:color_decode_ansi,1,test_\x1B[92mlightgreen}");
snprintf (str_value, sizeof (str_value),

View File

@ -585,14 +585,14 @@ TEST(GuiColor, DecodeAnsi)
WEE_CHECK_DECODE_ANSI("test_blue", "test_\x1B[34mblue", 0);
snprintf (string, sizeof (string),
"test_%sblue",
gui_color_get_custom ("blue"));
gui_color_get_custom ("|blue"));
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[34mblue", 1);
/* bright text color */
WEE_CHECK_DECODE_ANSI("test_lightgreen", "test_\x1B[92mlightgreen", 0);
snprintf (string, sizeof (string),
"test_%slightgreen",
gui_color_get_custom ("lightgreen"));
gui_color_get_custom ("|lightgreen"));
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[92mlightgreen", 1);
/* text terminal color */