diff --git a/CHANGES.rst b/CHANGES.rst index 6214bc0..5d9f1a5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,12 +3,13 @@ CHANGE HISTORY LATEST ------ +- Dropped support for Python 2, Python 3.9 or above is now required. - Added support for ColouredText titles in MultiColumnLIstBox. - Added gutter option to Layout. - Added speed option to Sprite. - Fixed bug where moving focus between Frames resulted in no current focus. - Fixed internal state of RadioButton values to be consistent with selection. -- Dropped support for Python 2, Python 3.9 or above is now required. +- Fixed handling of zero width modifiers. 1.14.0 ------ diff --git a/asciimatics/screen.py b/asciimatics/screen.py index 054e8e9..2dd2eee 100644 --- a/asciimatics/screen.py +++ b/asciimatics/screen.py @@ -626,6 +626,11 @@ def print_at(self, text, x, y, colour=7, attr=0, bg=0, transparent=False): if x + i + j + width > self.width: return + # Handle modifier glyphs - just delete them for now. + if width == 0: + j -= 1 + continue + # Now handle the update. if c != " " or not transparent: # Fix up orphaned double-width glyphs that we've just bisected. diff --git a/tests/test_screen.py b/tests/test_screen.py index dbc2171..fefe4b1 100644 --- a/tests/test_screen.py +++ b/tests/test_screen.py @@ -918,6 +918,14 @@ def test_cjk_glyphs_overwrite(self): # twice, reflecting their extra width. self.assert_line_equals(screen, "x你你確確 ", y=1, length=6) + def test_zero_width(self): + """ + Check that zero width modifiers are ignored. + """ + screen = Screen.open(unicode_aware=True) + screen.print_at("Xx🛡️🍀🍀xX", 0, 0) + self.assert_line_equals(screen, "Xx🛡🍀🍀🍀🍀xX", length=9) + def test_save_signal_state(self): """Tests that the signal state class works properly.