mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Fix endRow calculation
This commit is contained in:
@@ -168,7 +168,7 @@ describe "TextEditorPresenter", ->
|
||||
|
||||
describe "when ::clientHeight changes", ->
|
||||
it "updates the lines that are visible on screen", ->
|
||||
presenter = new TextEditorPresenter(model: editor, clientHeight: 25, scrollTop: 15, lineHeight: 10, lineOverdrawMargin: 1)
|
||||
presenter = new TextEditorPresenter(model: editor, clientHeight: 15, scrollTop: 15, lineHeight: 10, lineOverdrawMargin: 1)
|
||||
|
||||
line5 = editor.tokenizedLineForScreenRow(5)
|
||||
expect(presenter.state.lines[line5.id]).toBeUndefined()
|
||||
|
||||
@@ -58,10 +58,9 @@ class TextEditorPresenter
|
||||
Math.max(0, startRow)
|
||||
|
||||
getEndRow: ->
|
||||
startRow = @getStartRow()
|
||||
startRow = Math.floor(@getScrollTop() / @getLineHeight())
|
||||
visibleLinesCount = Math.ceil(@getClientHeight() / @getLineHeight()) + 1
|
||||
overdrawMargin = @lineOverdrawMargin + Math.min(@lineOverdrawMargin, startRow)
|
||||
endRow = startRow + visibleLinesCount + overdrawMargin
|
||||
endRow = startRow + visibleLinesCount + @lineOverdrawMargin
|
||||
Math.min(@model.getScreenLineCount(), endRow)
|
||||
|
||||
getScrollWidth: ->
|
||||
|
||||
Reference in New Issue
Block a user