diff --git a/spec/text-editor-element-spec.js b/spec/text-editor-element-spec.js index cb778e3ed..c92c6f144 100644 --- a/spec/text-editor-element-spec.js +++ b/spec/text-editor-element-spec.js @@ -349,7 +349,16 @@ describe('TextEditorElement', () => { await element.getNextUpdatePromise() expect(element.getVisibleRowRange()).toEqual([4, 11]) - expect(element.pixelRectForScreenRange([[2, 3], [13, 11]])).toEqual({top: 34, left: 22, height: 204, width: 57}) + const top = 2 * editor.getLineHeightInPixels() + const bottom = 13 * editor.getLineHeightInPixels() + const left = Math.round(3 * editor.getDefaultCharWidth()) + const right = Math.round(11 * editor.getDefaultCharWidth()) + expect(element.pixelRectForScreenRange([[2, 3], [13, 11]])).toEqual({ + top, + left, + height: bottom + editor.getLineHeightInPixels() - top, + width: right - left + }) }) }) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index ebaf611d8..f0e90e767 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -2667,7 +2667,7 @@ class TextEditorComponent { getScrollLeftColumn () { if (this.hasInitialMeasurements && this.getLongestLineWidth() != null) { - return Math.floor(this.getScrollLeft() / this.getBaseCharacterWidth()) + return Math.round(this.getScrollLeft() / this.getBaseCharacterWidth()) } else { return this.pendingScrollLeftColumn || 0 }