From 384b2f846223dcbfee56c63a0bae38a12daa5677 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 Jan 2022 08:57:14 +0530 Subject: [PATCH] Add roundtrip and cursor positioning tests for all three zero width chars --- gen-wcwidth.py | 4 ++++ kitty_tests/screen.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gen-wcwidth.py b/gen-wcwidth.py index 1b632b5a5..aeeab712c 100755 --- a/gen-wcwidth.py +++ b/gen-wcwidth.py @@ -112,6 +112,10 @@ def parse_ucd() -> None: elif category.startswith('S'): all_symbols.add(codepoint) elif category == 'Cf': + # we add Cf to marks as it contains things like tags and zero + # width chars. Not sure if *all* of Cf should be treated as + # combining chars, might need to add individual exceptions in + # the future. marks.add(codepoint) with open('nerd-fonts-glyphs.txt') as f: diff --git a/kitty_tests/screen.py b/kitty_tests/screen.py index 5ed69d2c5..5a638aff8 100644 --- a/kitty_tests/screen.py +++ b/kitty_tests/screen.py @@ -127,6 +127,12 @@ class TestScreen(BaseTest): s.draw(q) self.ae(q, str(s.line(0))) self.ae(s.cursor.x, 8) + for x in '\u200b\u200c\u200d': + s = self.create_screen() + q = f'X{x}Y' + s.draw(q) + self.ae(q, str(s.line(0))) + self.ae(s.cursor.x, 2) def test_char_manipulation(self): s = self.create_screen()