mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Don't break subpixel AA when cursor is at the end of longest line
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: * If there's a character after the cursor, the width corresponds to width of such character. * Otherwise, the width equals to the "base character width" measured on a dummy line. 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 commit, 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.
This commit is contained in:
parent
08d5677ddc
commit
3fbfadde5a
@ -2694,7 +2694,7 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
getContentWidth () {
|
||||
return Math.round(this.getLongestLineWidth() + this.getBaseCharacterWidth())
|
||||
return Math.ceil(this.getLongestLineWidth() + this.getBaseCharacterWidth())
|
||||
}
|
||||
|
||||
getScrollContainerClientWidthInBaseCharacters () {
|
||||
|
Loading…
Reference in New Issue
Block a user