Skip to content

Commit

Permalink
Let width table treat 0-width chars as 1-width
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 16, 2023
1 parent ecb5fdf commit 0ab121e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/make_width_table.py
Expand Up @@ -28,7 +28,11 @@ def make_width_table() -> Iterable[Tuple[int, int, int]]:
range_width = -2
for codepoint in range(0, sys.maxunicode + 1):
width = wcwidth.wcwidth(chr(codepoint))
if width == 1:
if width <= 1:
# Ignore narrow characters along with zero-width characters so that
# they are treated as single-width. Note that treating zero-width
# characters as single-width is consistent with the heuristics built
# on top of str.isascii() in the str_width() function in strings.py.
continue
if start_codepoint < 0:
start_codepoint = codepoint
Expand Down

0 comments on commit 0ab121e

Please sign in to comment.