From 087dc3b4fd6348675e136e06a36db70751dbe7bc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 18 Dec 2015 15:18:04 +0100 Subject: [PATCH] Back to green specs :metal: --- spec/text-editor-presenter-spec.coffee | 2 +- src/lines-yardstick.coffee | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 98285c7b2..36395feed 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -893,7 +893,7 @@ describe "TextEditorPresenter", -> expect(getState(presenter).content.scrollTop).toBe 13 it "scrolls down automatically when the model is changed", -> - presenter = buildPresenter(scrollTop: 0, lineHeight: 10, explicitHeight: 10) + presenter = buildPresenter(scrollTop: 0, lineHeight: 10, explicitHeight: 20) editor.setText("") editor.insertNewline() diff --git a/src/lines-yardstick.coffee b/src/lines-yardstick.coffee index 6bc691639..3be276412 100644 --- a/src/lines-yardstick.coffee +++ b/src/lines-yardstick.coffee @@ -20,10 +20,11 @@ class LinesYardstick targetTop = pixelPosition.top targetLeft = pixelPosition.left defaultCharWidth = @model.getDefaultCharWidth() - row = @lineTopIndex.rowForPixelPosition(targetTop, 'floor') + row = @lineTopIndex.rowForPixelPosition(targetTop) targetLeft = 0 if targetTop < 0 targetLeft = Infinity if row > @model.getLastScreenRow() row = Math.min(row, @model.getLastScreenRow()) + row = Math.max(0, row) line = @model.tokenizedLineForScreenRow(row) lineNode = @lineNodesProvider.lineNodeForLineIdAndScreenRow(line?.id, row)