This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
Don't break subpixel AA when cursor is at the end of longest line #16595
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
With the Electron upgrade, something changed in the way characters are rendered/measured, and that was causing subpixel anti-aliasing to stop working when cursors were at the end of the longest line.
Every cursor has a width that is calculated in the following way:
In the latter case, even if we were setting the width of the content container to account for the width of such cursor, some rounding problem was causing the cursor to be able to escape the container and thus break subpixel anti-aliasing.
With this pull request, instead of rounding the value we assign to the container width, we will always ceil it. This ensures that cursors are always strictly contained within the parent element and resolves the subpixel anti-aliasing issue.
Alternate Designs
None.
Benefits
Fixes a regression in the subpixel anti-aliasing rendering code path that was causing text to look blurry when cursor was at the end of the longest line.
Possible Drawbacks
None.
Verification Process
See previously attached GIFs.
Applicable Issues
It doesn't seem like this problem has been reported anywhere. /cc: @Ben3eeE @ungb @rsese in case you are aware of any recent report about this. If so, feel free to edit the body of this pull request to automatically close any relevant issue once this pull request gets merged.
/cc: @nathansobo