Back to green specs 🤘

This commit is contained in:
Antonio Scandurra 2015-12-18 15:18:04 +01:00
parent 907dc661ec
commit 087dc3b4fd
2 changed files with 3 additions and 2 deletions

View File

@ -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()

View File

@ -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)