Browse Source

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

master
Sébastien Helleu 2 years ago
parent
commit
20866a0457
  1. 1
      ChangeLog.adoc
  2. 12
      src/gui/gui-color.c
  3. 2
      tests/unit/core/test-core-eval.cpp
  4. 4
      tests/unit/gui/test-gui-color.cpp

1
ChangeLog.adoc

@ -39,6 +39,7 @@ New features:: @@ -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)

12
src/gui/gui-color.c

@ -1036,8 +1036,10 @@ gui_color_decode_ansi_cb (void *data, const char *text) @@ -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) @@ -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:

2
tests/unit/core/test-core-eval.cpp

@ -677,7 +677,7 @@ TEST(CoreEval, EvalExpression) @@ -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),

4
tests/unit/gui/test-gui-color.cpp

@ -585,14 +585,14 @@ TEST(GuiColor, DecodeAnsi) @@ -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 */

Loading…
Cancel
Save