termptyesc: handle zero-width spaces, with test

This commit is contained in:
Boris Faure 2020-02-16 18:51:36 +01:00
parent 91e6ae31fc
commit 2a3a34f503
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
3 changed files with 22 additions and 2 deletions

View File

@ -206,8 +206,8 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
}
g = _termpty_charset_trans(ty, codepoints[i]);
/* Skip 0-width space */
if (EINA_UNLIKELY(g == 0x200b))
/* Skip 0-width space or RTL/LTR marks */
if (EINA_UNLIKELY(g >= 0x200b && g <= 0x200f))
{
continue;
}

View File

@ -122,3 +122,8 @@ osc-11-query.sh b762d503e40641ff896dac46391ad7a8
link_detection.sh bbe87a849586e8b922f26ad5d88146dc
selection_with_tabs.sh 23557497a8f28ca246048bb2443b3dab
selection_empty_lines.sh 7a90d9bfde9e9fb7f067f6c08eac57ff
osc-invalid.sh 0acecbe16bb3b257745787c40affdb90
title_icon_stack_simple.sh 9231de4459dbb52d0ffab6f33fc386a0
title_icon_stack_unset.sh d2ebe2295eb036d9612209490f8aa7f9
title_icon_stack_default.sh d2ebe2295eb036d9612209490f8aa7f9
zero-width-spaces.sh 4bbf6bbaef5f651d27b7593d82650de9

15
tests/zero-width-spaces.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# fill space with E
printf '\033#8'
#set color
printf '\033[46;31;3m'
# Zero width space
printf 'aa\xe2\x80\x8baa\n'
# Zero width space non-joiner
printf 'aa\xe2\x80\x8caa\n'
# Zero width space joiner
printf 'aa\xe2\x80\x8daa\n'