Merge pull request #16595 from atom/as-fix-subpixel-aa

Don't break subpixel AA when cursor is at the end of longest line
This commit is contained in:
Antonio Scandurra 2018-01-20 17:00:49 +01:00 committed by GitHub
commit ef96cc770e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -104,7 +104,7 @@ describe('TextEditorComponent', () => {
{
expect(editor.getApproximateLongestScreenRow()).toBe(3)
const expectedWidth = Math.round(
const expectedWidth = Math.ceil(
component.pixelPositionForScreenPosition(Point(3, Infinity)).left +
component.getBaseCharacterWidth()
)
@ -121,7 +121,7 @@ describe('TextEditorComponent', () => {
// Capture the width of the lines before requesting the width of
// longest line, because making that request forces a DOM update
const actualWidth = element.querySelector('.lines').style.width
const expectedWidth = Math.round(
const expectedWidth = Math.ceil(
component.pixelPositionForScreenPosition(Point(6, Infinity)).left +
component.getBaseCharacterWidth()
)
@ -3980,7 +3980,7 @@ describe('TextEditorComponent', () => {
// Capture the width of the lines before requesting the width of
// longest line, because making that request forces a DOM update
const actualWidth = element.querySelector('.lines').style.width
const expectedWidth = Math.round(
const expectedWidth = Math.ceil(
component.pixelPositionForScreenPosition(Point(3, Infinity)).left +
component.getBaseCharacterWidth()
)

View File

@ -2694,7 +2694,7 @@ class TextEditorComponent {
}
getContentWidth () {
return Math.round(this.getLongestLineWidth() + this.getBaseCharacterWidth())
return Math.ceil(this.getLongestLineWidth() + this.getBaseCharacterWidth())
}
getScrollContainerClientWidthInBaseCharacters () {