mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
Make all lines visible if no external client height is assigned
This commit is contained in:
parent
ac463143dd
commit
7095ccd32b
@ -93,6 +93,11 @@ describe "TextEditorPresenter", ->
|
||||
expect(presenter.state.lines[editor.tokenizedLineForScreenRow(9).id]).toBeDefined()
|
||||
expect(presenter.state.lines[editor.tokenizedLineForScreenRow(10).id]).toBeUndefined()
|
||||
|
||||
it "reports all lines as visible if no external ::clientHeight is assigned", ->
|
||||
presenter = new TextEditorPresenter(model: editor, scrollTop: 0, lineHeight: 10, lineOverdrawMargin: 1)
|
||||
expect(presenter.state.lines[editor.tokenizedLineForScreenRow(0).id]).toBeDefined()
|
||||
expect(presenter.state.lines[editor.tokenizedLineForScreenRow(12).id]).toBeDefined()
|
||||
|
||||
it "uses the computed scrollWidth as the length of each line", ->
|
||||
line0 = editor.tokenizedLineForScreenRow(0)
|
||||
line1 = editor.tokenizedLineForScreenRow(1)
|
||||
|
@ -58,7 +58,7 @@ class TextEditorPresenter
|
||||
|
||||
getEndRow: ->
|
||||
startRow = @getStartRow()
|
||||
visibleLinesCount = Math.ceil(@clientHeight / @lineHeight) + 1
|
||||
visibleLinesCount = Math.ceil(@getClientHeight() / @lineHeight) + 1
|
||||
overdrawMargin = @lineOverdrawMargin + Math.min(@lineOverdrawMargin, startRow)
|
||||
endRow = startRow + visibleLinesCount + overdrawMargin
|
||||
Math.min(@model.getScreenLineCount(), endRow)
|
||||
@ -74,6 +74,9 @@ class TextEditorPresenter
|
||||
setClientHeight: (@clientHeight) ->
|
||||
@updateLinesState()
|
||||
|
||||
getClientHeight: ->
|
||||
@clientHeight ? @model.getScreenLineCount() * @lineHeight
|
||||
|
||||
setClientWidth: (@clientWidth) ->
|
||||
@updateLinesState()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user