Update cursors when the line height in pixels changes

This commit is contained in:
Nathan Sobo
2014-06-02 11:33:16 +09:00
parent 1bce626324
commit 3052fe3f3b
2 changed files with 8 additions and 2 deletions

View File

@@ -384,6 +384,12 @@ describe "EditorComponent", ->
expect(cursorNodes.length).toBe 1
expect(cursorNodes[0].style['-webkit-transform']).toBe "translate3d(#{8 * charWidth}px, #{6 * lineHeightInPixels}px, 0px)"
it "updates cursor positions when the line height changes", ->
editor.setCursorBufferPosition([1, 10])
cursorNode = node.querySelector('.cursor')
component.setLineHeight(2)
expect(cursorNode.style['-webkit-transform']).toBe "translate3d(#{10 * editor.getDefaultCharWidth()}px, #{editor.getLineHeightInPixels()}px, 0px)"
describe "selection rendering", ->
[scrollViewNode, scrollViewClientLeft] = []

View File

@@ -33,8 +33,8 @@ CursorsComponent = React.createClass
@stopBlinkingCursors()
shouldComponentUpdate: (newProps, newState) ->
not isEqualForProperties(newProps, @props, 'cursorScreenRanges', 'scrollTop', 'scrollLeft') or
not newState.blinkOff is @state.blinkOff
not newState.blinkOff is @state.blinkOff or
not isEqualForProperties(newProps, @props, 'cursorScreenRanges', 'scrollTop', 'scrollLeft', 'lineHeightInPixels')
componentWillUpdate: (newProps) ->
@pauseCursorBlinking() if @props.cursorScreenRanges and not isEqual(newProps.cursorScreenRanges, @props.cursorScreenRanges)