diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | src/gui/gui-color.c | 12 | ||||
-rw-r--r-- | tests/unit/core/test-core-eval.cpp | 2 | ||||
-rw-r--r-- | tests/unit/gui/test-gui-color.cpp | 4 |
4 files changed, 12 insertions, 7 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 5d737f8c2..3b546a3dd 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -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) diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index aee0d8199..80fe1e5d7 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -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: diff --git a/tests/unit/core/test-core-eval.cpp b/tests/unit/core/test-core-eval.cpp index f542641da..d655dca4b 100644 --- a/tests/unit/core/test-core-eval.cpp +++ b/tests/unit/core/test-core-eval.cpp @@ -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), diff --git a/tests/unit/gui/test-gui-color.cpp b/tests/unit/gui/test-gui-color.cpp index fdd19c4dc..e8e629ea3 100644 --- a/tests/unit/gui/test-gui-color.cpp +++ b/tests/unit/gui/test-gui-color.cpp @@ -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 */ |