Skip to content

Commit 31930dd

Browse files
committed
fix test
1 parent 454fcfc commit 31930dd

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

rich/cells.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ def _cell_len(text: str, unicode_version: str) -> int:
150150
while index < character_count:
151151
character = text[index]
152152
if character in SPECIAL:
153-
if character == "\ufe0f" and last_measured_character:
153+
if character == "\u200d":
154+
index += 1
155+
elif character == "\ufe0f" and last_measured_character:
154156
total_width += last_measured_character in cell_table.narrow_to_wide
155157
last_measured_character = None
156158
else:

tests/test_cells.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ def test_zwj():
194194
assert cell_len("") == 0
195195
assert cell_len("\u200d") == 0
196196
assert cell_len("1\u200d") == 1
197-
assert cell_len("1\u200d2") == 2
197+
# This sequence should really produce 2, but it aligns with with wcwidth
198+
# What gets written to the terminal is anybody's guess, I've seen multiple variations
199+
assert cell_len("1\u200d2") == 1
198200

199201

200202
def test_non_printable():

0 commit comments

Comments
 (0)