-
Notifications
You must be signed in to change notification settings - Fork 901
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
Formatter: Unicode width is too high #6499
Comments
How did you measure the width in Pycharm? I understand that Pycharms cursor position (row:column) is character based and not width based. |
Black migrates to use unicode-width in preview style, but only for strings (not identifiers). Edit: But we should look into this. |
black does also break in preview mode! I guess it makes more sense by the unicode text width algorithm but it's also odd because it's different from the actual text rendering |
@konstin and I talked about this and we must admit, we're confused. I will close this issue because I believe we're doing the right thing. Please open a new issue and link this issue if you're more familiar with CJK characters and/or have reasons to believe that the implementation is incorrect. We'll hopefully be able to figure out the correct behavior together. Reasons for closing:
I also went ahead and pasted the example into my IDE and it seems it exceeds the column width for my configuration (the |
The following snippet fits visually in pycharm and is kept in this layout by black
ruff formats it as
We likely compute the unicode width of the string too high so that we assume the line is too long
The text was updated successfully, but these errors were encountered: