-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Black joins lines when it shouldn't - short width characters. #4235
Comments
This was changed as a result of #3445. Could you explain why you think this is a bug? The line is displayed as <100 characters in length, even if it contains more than 100 characters. |
This is fairly common for Chinese characters, see the issue I linked. I assume Sonar is https://www.sonarsource.com/products/sonarlint/ ? Possibly linters should also adjust their line length computations to take character width into account. However, that might be more trouble than it's worth. I think I'd be OK with adjusting our logic to treat all characters as having a minimum length of 1. This would go into the preview style now and into the stable style for 2025. |
It looks like this was an issue with the `_width_table.py` file being out of date in some way. Closes psf#4235.
It looks like this was an issue with the `_width_table.py` file being out of date in some way. Closes psf#4235.
It looks like this was an issue with the `_width_table.py` file being out of date in some way. Closes psf#4235.
Describe the bug
Black doesn't count line length correctly in case of khmer characters. They fit screen-wise (kind of) but character length goes beyond limit.
To Reproduce
For example, take this code:
And run it with these arguments:
The resulting error is:
Expected behavior
No changes because line won't fit.
Environment
Additional context
The line is split correctly before changes but when joined like
black
does (even when we remove" "
and parens) then it doesn't fit inside 100 characters.The text was updated successfully, but these errors were encountered: