diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index d9d247580..63495429a 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -8,7 +8,7 @@ $ = require 'jquery' _ = require 'underscore' fs = require 'fs' -describe "Editor", -> +fdescribe "Editor", -> [rootView, buffer, editor, cachedLineHeight] = [] getLineHeight = -> @@ -72,7 +72,7 @@ describe "Editor", -> newEditor.width(editor.width()) rootView.remove() newEditor.attachToDom() - expect(newEditor.scrollTop()).toBe 1.5 * editor.lineHeight + expect(newEditor.scrollTop()).toBe editor.scrollTop() expect(newEditor.scrollView.scrollLeft()).toBe 44 describe ".setBuffer(buffer)", -> @@ -701,7 +701,8 @@ describe "Editor", -> expect(editor.renderedLines.find('.line').text()).toBe buffer.lineForRow(0) describe "when autoscrolling at the end of the document", -> - xit "renders lines properly", -> + it "renders lines properly", -> + console.log editor.lineOverdraw editor.setBuffer(new Buffer(require.resolve 'fixtures/two-hundred.txt')) editor.attachToDom(heightInLines: 5.5) expect(editor.renderedLines.find('.line').length).toBe 8 diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 159591507..fa66776ce 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -273,7 +273,9 @@ class Editor extends View scrollTop: (scrollTop, options) -> return @cachedScrollTop or 0 unless scrollTop? - scrollTop = Math.max(0, scrollTop) + maxScrollTop = @scrollView.prop('scrollHeight') - @scrollView.height() + scrollTop = Math.floor(Math.min(maxScrollTop, Math.max(0, scrollTop))) + return if scrollTop == @cachedScrollTop @cachedScrollTop = scrollTop