mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Update cursors as soon as all required measurements are assigned
This commit is contained in:
@@ -923,7 +923,7 @@ describe "TextEditorPresenter", ->
|
||||
expect(stateForCursor(presenter, 4)).toBeUndefined()
|
||||
|
||||
it "is empty until all of the required measurements are assigned", ->
|
||||
presenter = buildPresenter(explicitHeight: null, lineHeight: null, scrollTop: null, baseCharacterWidth: null)
|
||||
presenter = buildPresenter(explicitHeight: null, lineHeight: null, scrollTop: null, baseCharacterWidth: null, horizontalScrollbarHeight: null)
|
||||
expect(presenter.state.content.cursors).toEqual({})
|
||||
|
||||
presenter.setExplicitHeight(25)
|
||||
@@ -936,6 +936,9 @@ describe "TextEditorPresenter", ->
|
||||
expect(presenter.state.content.cursors).toEqual({})
|
||||
|
||||
presenter.setBaseCharacterWidth(8)
|
||||
expect(presenter.state.content.cursors).toEqual({})
|
||||
|
||||
presenter.setHorizontalScrollbarHeight(10)
|
||||
expect(presenter.state.content.cursors).not.toEqual({})
|
||||
|
||||
it "updates when ::scrollTop changes", ->
|
||||
|
||||
@@ -483,23 +483,29 @@ class TextEditorPresenter
|
||||
setScrollLeft: (scrollLeft) ->
|
||||
scrollLeft = @constrainScrollLeft(scrollLeft)
|
||||
unless @scrollLeft is scrollLeft
|
||||
oldScrollLeft = @scrollLeft
|
||||
@scrollLeft = scrollLeft
|
||||
@model.setScrollLeft(scrollLeft)
|
||||
@updateHorizontalScrollState()
|
||||
@updateCursorsState() unless oldScrollLeft?
|
||||
|
||||
setHorizontalScrollbarHeight: (horizontalScrollbarHeight) ->
|
||||
unless @horizontalScrollbarHeight is horizontalScrollbarHeight
|
||||
oldHorizontalScrollbarHeight = @horizontalScrollbarHeight
|
||||
@horizontalScrollbarHeight = horizontalScrollbarHeight
|
||||
@model.setHorizontalScrollbarHeight(horizontalScrollbarHeight)
|
||||
@updateScrollbarsState()
|
||||
@updateVerticalScrollState()
|
||||
@updateCursorsState() unless oldHorizontalScrollbarHeight?
|
||||
|
||||
setVerticalScrollbarWidth: (verticalScrollbarWidth) ->
|
||||
unless @verticalScrollbarWidth is verticalScrollbarWidth
|
||||
oldVerticalScrollbarWidth = @verticalScrollbarWidth
|
||||
@verticalScrollbarWidth = verticalScrollbarWidth
|
||||
@model.setVerticalScrollbarWidth(verticalScrollbarWidth)
|
||||
@updateScrollbarsState()
|
||||
@updateHorizontalScrollState()
|
||||
@updateCursorsState() unless oldVerticalScrollbarWidth?
|
||||
|
||||
setAutoHeight: (autoHeight) ->
|
||||
unless @autoHeight is autoHeight
|
||||
@@ -522,6 +528,7 @@ class TextEditorPresenter
|
||||
|
||||
setContentFrameWidth: (contentFrameWidth) ->
|
||||
unless @contentFrameWidth is contentFrameWidth
|
||||
oldContentFrameWidth = @contentFrameWidth
|
||||
@contentFrameWidth = contentFrameWidth
|
||||
@model.setWidth(contentFrameWidth)
|
||||
@updateVerticalScrollState()
|
||||
@@ -530,6 +537,7 @@ class TextEditorPresenter
|
||||
@updateContentState()
|
||||
@updateDecorations()
|
||||
@updateLinesState()
|
||||
@updateCursorsState() unless oldContentFrameWidth?
|
||||
|
||||
setBackgroundColor: (backgroundColor) ->
|
||||
unless @backgroundColor is backgroundColor
|
||||
|
||||
Reference in New Issue
Block a user