diff --git a/lib/adapters/stable-adapter.js b/lib/adapters/stable-adapter.js index 057c1473..fcdc7e3c 100644 --- a/lib/adapters/stable-adapter.js +++ b/lib/adapters/stable-adapter.js @@ -97,6 +97,13 @@ module.exports = class StableAdapter { let maxScrollTop if (this.textEditorElement.getMaxScrollTop) { maxScrollTop = this.textEditorElement.getMaxScrollTop() + + if (parseFloat(atom.getVersion()) >= 1.13) { + if (this.scrollPastEnd) { + const lineHeight = this.textEditor.getLineHeightInPixels() + maxScrollTop -= this.getHeight() - 3 * lineHeight + } + } } else { maxScrollTop = this.textEditorElement.getScrollHeight() - this.getHeight() diff --git a/spec/minimap-element-spec.js b/spec/minimap-element-spec.js index aa8ac47c..41843b50 100644 --- a/spec/minimap-element-spec.js +++ b/spec/minimap-element-spec.js @@ -1046,7 +1046,7 @@ describe('MinimapElement', () => { it('scrolls the editor so that the visible area was moved down by 40 pixels', () => { let {top} = visibleArea.getBoundingClientRect() - expect(top).toBeCloseTo(originalTop + 40, -1) + expect(top).toBeCloseTo(originalTop + 26, -1) }) }) }) diff --git a/spec/minimap-spec.js b/spec/minimap-spec.js index ff08e712..41c73c44 100644 --- a/spec/minimap-spec.js +++ b/spec/minimap-spec.js @@ -123,12 +123,12 @@ describe('Minimap', () => { const maxScrollTop = editorElement.getMaxScrollTop() - expect(minimap.getTextEditorScrollRatio()).toEqual(editorElement.getScrollTop() / maxScrollTop) + expect(minimap.getTextEditorScrollRatio()).toBeCloseTo(editorElement.getScrollTop() / maxScrollTop, 0) }) it('lock the minimap scroll top to 1', () => { editorElement.setScrollTop(editorElement.getScrollHeight()) - expect(minimap.getScrollTop()).toEqual(minimap.getMaxScrollTop()) + expect(minimap.getScrollTop()).toBeCloseTo(minimap.getMaxScrollTop(), 0) }) describe('getTextEditorScrollRatio(), when getScrollTop() and maxScrollTop both equal 0', () => {