Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

U+2064 to U+206f are 0 width, but wcwidth returns 1 width #26

Closed
charlie-collard opened this issue Feb 12, 2019 · 5 comments
Closed

U+2064 to U+206f are 0 width, but wcwidth returns 1 width #26

charlie-collard opened this issue Feb 12, 2019 · 5 comments

Comments

@charlie-collard
Copy link

base = ord('\u2064')
for i in range(12):
    print('A' + chr(base+i) + 'B')
@jquast
Copy link
Owner

jquast commented Jun 1, 2020

In iTerm2, these are all displayed as an empty space (1 cell wide), so wcwidth matches there.
What terminal/s are you using that displays these as 0 wide? I will try some others given time

@jquast
Copy link
Owner

jquast commented Jun 1, 2020

From http://www.unicode.org/Public/13.0.0/ucd/extracted/DerivedGeneralCategory.txt

2060..2064    ; Cf #   [5] WORD JOINER..INVISIBLE PLUS

@tiptenbrink
Copy link

This is still an issue, see the linked issue above.

@jquast
Copy link
Owner

jquast commented Nov 15, 2021

I will do my best to address this in next release, this is the FOSS project I most wish to volunteer my time into, I just pushed my WIP branch https://github.com/jquast/wcwidth/compare/use-jinja?expand=1#diff-a7a564eab7d7101276d9c63a7bc6505f4dc79188333295b7a3e62636862ac367R163-R165 as I hope I can then better generate code for other languages using jinja2 and get these issues fixed more universally.

But anyway I start a new job today, so that's life!

jquast added a commit that referenced this issue Oct 30, 2023
Major
-----

Bugfix zero-with characters, closes #57, #47, #45, #39, #26, #25, #24, #22, #8, wow !

This is mostly achieved by replacing `ZERO_WIDTH_CF` with dynamic parsing by Category codes in bin/update-tables.py and putting those in the zero-wide tables.

Tests
-----

- `verify-table-integrity.py` exercises a "bug" of duplicated tables that has no effect, because wcswidth() first checks for zero-width, and that is preferred in cases of conflict. This PR also resolves that error of duplication.
- new automatic tests for balinese, kr jamo, zero-width emoji, devanagari, tamil, kannada.  
- added pytest-benchmark plugin, example use:

        # baseline
        tox -epy312 -- --verbose --benchmark-save=original
        # compare
        tox -epy312 -- --verbose --benchmark-compare=.benchmarks/Linux-CPython-3.12-64bit/0001_original.json
@jquast
Copy link
Owner

jquast commented Oct 30, 2023

This is closed in today's release by #91

@jquast jquast closed this as completed Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants