summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2020-02-16 18:51:36 +0100
committerBoris Faure <billiob@gmail.com>2020-02-16 18:51:36 +0100
commit2a3a34f5038eabc0e4d7ef9b80ba5f5f94693958 (patch)
treef7b5bba1625305f768232ecfdbc164cd46cf8e3e
parent91e6ae31fceaaf4424f811276a8bff577c0f89a6 (diff)
termptyesc: handle zero-width spaces, with test
-rw-r--r--src/bin/termptyops.c4
-rw-r--r--tests/tests.results5
-rwxr-xr-xtests/zero-width-spaces.sh15
3 files changed, 22 insertions, 2 deletions
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 27c4399..2ea8fc9 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -206,8 +206,8 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
206 } 206 }
207 207
208 g = _termpty_charset_trans(ty, codepoints[i]); 208 g = _termpty_charset_trans(ty, codepoints[i]);
209 /* Skip 0-width space */ 209 /* Skip 0-width space or RTL/LTR marks */
210 if (EINA_UNLIKELY(g == 0x200b)) 210 if (EINA_UNLIKELY(g >= 0x200b && g <= 0x200f))
211 { 211 {
212 continue; 212 continue;
213 } 213 }
diff --git a/tests/tests.results b/tests/tests.results
index 356b5ad..a5e408f 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -122,3 +122,8 @@ osc-11-query.sh b762d503e40641ff896dac46391ad7a8
122link_detection.sh bbe87a849586e8b922f26ad5d88146dc 122link_detection.sh bbe87a849586e8b922f26ad5d88146dc
123selection_with_tabs.sh 23557497a8f28ca246048bb2443b3dab 123selection_with_tabs.sh 23557497a8f28ca246048bb2443b3dab
124selection_empty_lines.sh 7a90d9bfde9e9fb7f067f6c08eac57ff 124selection_empty_lines.sh 7a90d9bfde9e9fb7f067f6c08eac57ff
125osc-invalid.sh 0acecbe16bb3b257745787c40affdb90
126title_icon_stack_simple.sh 9231de4459dbb52d0ffab6f33fc386a0
127title_icon_stack_unset.sh d2ebe2295eb036d9612209490f8aa7f9
128title_icon_stack_default.sh d2ebe2295eb036d9612209490f8aa7f9
129zero-width-spaces.sh 4bbf6bbaef5f651d27b7593d82650de9
diff --git a/tests/zero-width-spaces.sh b/tests/zero-width-spaces.sh
new file mode 100755
index 0000000..0ff4cf4
--- /dev/null
+++ b/tests/zero-width-spaces.sh
@@ -0,0 +1,15 @@
1#!/bin/sh
2
3# fill space with E
4printf '\033#8'
5#set color
6printf '\033[46;31;3m'
7
8# Zero width space
9printf 'aa\xe2\x80\x8baa\n'
10
11# Zero width space non-joiner
12printf 'aa\xe2\x80\x8caa\n'
13
14# Zero width space joiner
15printf 'aa\xe2\x80\x8daa\n'