core: add support of reverse video in ANSI color codes

v2.8-utf8proc
Sébastien Helleu 2019-09-29 16:30:57 +02:00
parent a8ca4b5b3a
commit 177fa6c528
3 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,7 @@ New features::
Bug fixes::
* core: add support of reverse video in ANSI color codes
* core: fixed segfault during excessive evaluation in function string_repeat (issue #1400)
* buflist: fix extra spaces between buffers when conditions are used to hide buffers (regression introduced in version 2.6) (issue #1403)
* irc: remove option irc.network.channel_encode, add server option "charset_message" to control which part of the IRC message is decoded/encoded to the target charset (issue #832)

View File

@ -833,12 +833,18 @@ gui_color_decode_ansi_cb (void *data, const char *text)
case 4: /* underline */
strcat (output, gui_color_get_custom ("underline"));
break;
case 7: /* reverse */
strcat (output, gui_color_get_custom ("reverse"));
break;
case 23: /* remove italic */
strcat (output, gui_color_get_custom ("-italic"));
break;
case 24: /* remove underline */
strcat (output, gui_color_get_custom ("-underline"));
break;
case 27: /* remove reverse */
strcat (output, gui_color_get_custom ("-reverse"));
break;
case 30: /* text color */
case 31:
case 32:

View File

@ -437,6 +437,15 @@ TEST(GuiColor, ColorDecodeAnsi)
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[1mbold\x1B[21m_end", 1);
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[1mbold\x1B[22m_end", 1);
/* reverse */
WEE_CHECK_DECODE_ANSI("test_reverse_end",
"test_\x1B[7mreverse\x1B[27m_end", 0);
snprintf (string, sizeof (string),
"test_%sreverse%s_end",
gui_color_get_custom ("reverse"),
gui_color_get_custom ("-reverse"));
WEE_CHECK_DECODE_ANSI(string, "test_\x1B[7mreverse\x1B[27m_end", 1);
/* italic */
WEE_CHECK_DECODE_ANSI("test_italic_end",
"test_\x1B[3mitalic\x1B[23m_end", 0);