-
Notifications
You must be signed in to change notification settings - Fork 227
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
Handle preceding whitespaces in write() for line break #947
Handle preceding whitespaces in write() for line break #947
Conversation
I'm really not sure if this is the correct approach. Why add extra text data that is not actually supposed to appear on page? How can you be sure that this never has any unintended side effects? It would be much simpler and more logical to just add a check in As a potential source of unwanted interaction: In #897 I am adding functionality to |
@SaiHarshaK |
Got it, that makes sense. will do that and update this PR |
@andersonhc @gmischler Please check now |
@gmischler @andersonhc is there a way to rerun the tests? i think its complaining some existing test took too long than the limit set. Not sure why it complains only for a specific version of python, since it ran successfully some versions on windows |
Thanks, it seems the reruns got these passed :) |
This is a reccuring problem that we have, tracked in #923 I re-run the pipeline, and everything is ✅ now. |
Can you get this merged @Lucas-C |
I'll defer to @gmischler on this, as he is much more expert than me on the subject, By the way, are you taking part to Hacktoberfest @SaiHarshaK? |
Yes i am taking part in it, so it would be great if it gets merged. Maybe the tag itself is sufficient but im not sure though |
Actually, @andersonhc is the real expert here, as I haven't really touched the text shaping stuff. |
@allcontributors please add SaiHarshaK for code |
I've put up a pull request to add @SaiHarshaK! 🎉 |
Thank you! |
Thank YOU for your contribution to This has been released in 2.7.6 |
Fixes #902
This PR adds support to handle text starting with whitespaces which cause linebreak. In case of text with preceding whitespace being added any line with text, this would trigger a linebreak.
The issue currently is that on triggering linebreak, it currently throws an exception since the fragment is basically empty which would mean the perform_harfbuzz_shaping() would return None, and we would be unable to compute the shaped_text_width.
To solve this issue, we add a conditional check when
perform_harfbuzz_shaping()
return None, where we simply returnshaped_text_width
as (0, 0) (char len, char width)Using the repro in the issue, have added UT for the same.
Before code changes:
After code changes:
Checklist:
The GitHub pipeline is OK (green),
meaning that both
pylint
(static code analyzer) andblack
(code formatter) are happy with the changes of this PR.A unit test is covering the code added / modified by this PR
This PR is ready to be merged
[] In case of a new feature, docstrings have been added, with also some documentation in the
docs/
folderA mention of the change is present in
CHANGELOG.md
Since this is a bugfix and not a feature, not adding anything to docs folder.
By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.