Update presenter scrollHeight when clientHeight changes

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Max Brunsfeld
2015-01-26 15:33:14 -08:00
committed by Nathan Sobo
parent 33081cefda
commit f218e985cf
2 changed files with 6 additions and 0 deletions

View File

@@ -51,6 +51,11 @@ describe "TextEditorPresenter", ->
expectStateUpdate presenter, -> editor.getBuffer().append("\n\n\n")
expect(presenter.state.scrollHeight).toBe editor.getScreenLineCount() * 10
it "updates when ::clientHeight changes", ->
presenter = new TextEditorPresenter(model: editor, scrollTop: 0, lineHeight: 10)
expectStateUpdate presenter, -> presenter.setClientHeight(500)
expect(presenter.state.scrollHeight).toBe 500
describe ".scrollTop", ->
it "tracks the value of ::scrollTop", ->
presenter = new TextEditorPresenter(model: editor, scrollTop: 10, lineHeight: 10)

View File

@@ -295,6 +295,7 @@ class TextEditorPresenter
getScrollLeft: -> @scrollLeft
setClientHeight: (@clientHeight) ->
@updateVerticalScrollState()
@updateLinesState()
@updateCursorsState()
@updateHighlightsState()