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

fix: HighlighterText's text when the argument is the last characters of the whole string #216

Merged
merged 3 commits into from
Nov 28, 2024

Conversation

LunarX
Copy link
Contributor

@LunarX LunarX commented Nov 27, 2024

Fix two issues when the argument of a HighlighterText are the last characters of the whole string. This PR also refactors the code to make it easier to understand because things were not named very clearly. The refactor and the fixes are visible in different commits.


Details of the bugs:

The range passed as argument to getBoundingBoxesForRange should stop at the last index of the string to not crash with an out of bound exception.

Also, the right coordinate of the each returned bounding box should be defined based on the current bounding box's last character's rect. This wasn't properly handled when the last character of the current bounding box was in any line but the last one of the whole string vs when it was at the end of the whole string

The range passed as argument to getBoundingBoxesForRange should stop at the last index of the string to not crash with an out of bound exception.
the right coordinate of the each returned bounding box should be defined based on the current bounding box's last character's rect. This wasn't properly handled when the last character of the current bounding box was in any line but the last one of the whole string vs when it was at the end of the whole string
@LunarX LunarX added the bug Something isn't working label Nov 27, 2024
@LunarX LunarX requested a review from a team November 27, 2024 14:46
@LunarX LunarX self-assigned this Nov 27, 2024
Copy link

@LunarX LunarX changed the title fix: HighlighterText text when the argument is the last characters of the whole string fix: HighlighterText's text when the argument is the last characters of the whole string Nov 28, 2024
@LunarX LunarX merged commit f320bf9 into main Nov 28, 2024
10 checks passed
@LunarX LunarX deleted the fix-highlighter-text branch November 28, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants