1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

core: do not display non printable chars, fix function utf8_char_size_screen

Now the function utf8_char_size_screen can return -1 when the char is not
printable.

It has a specific behavior for some chars:

- U+0009: value of option weechat.look.tab_width
- U+0001 to U+001F (except U+0009): 1
- U+00AD (soft hyphen): -1
- U+200B (zero width space): -1
This commit is contained in:
Sébastien Helleu
2022-12-04 20:03:21 +01:00
parent d18f68e497
commit f1cfd6f73f
13 changed files with 337 additions and 175 deletions
+2 -4
View File
@@ -151,9 +151,8 @@ TEST(CoreCommand, Debug)
{
const char *command_debug_unicode =
"/debug unicode "
"\u00AD" /* soft hyphen */
"\u00E9" /* é */
"\u200B" /* zero width space */
"\u26C4" /* ⛄ (snowman without snow) */
"";
/* test command "/debug list" */
@@ -215,9 +214,8 @@ TEST(CoreCommand, Debug)
/* test command "/debug unicode" */
WEE_CMD_CORE(command_debug_unicode);
WEE_CHECK_MSG_CORE(" \"\u00AD\" (U+00AD, 173, 0xC2 0xAD): 2 / 1, 1 / 1, 1, 1, 1");
WEE_CHECK_MSG_CORE(" \"\u00E9\" (U+00E9, 233, 0xC3 0xA9): 2 / 1, 1 / 1, 1, 1, 1");
WEE_CHECK_MSG_CORE(" \"\u200B\" (U+200B, 8203, 0xE2 0x80 0x8B): 3 / 1, 1 / 0, 0, 0, 0");
WEE_CHECK_MSG_CORE(" \"\u26C4\" (U+26C4, 9924, 0xE2 0x9B 0x84): 3 / 1, 1 / 2, 2, 2, 2");
/* test command "/debug windows" */
/* TODO: write tests */