diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 5fb4e2f84..d8d5b9833 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -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", -> diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index d80e5d608..cbaba510d 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -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