diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 29ae73fdf..061b4277a 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -456,6 +456,12 @@ describe "EditorComponent", -> expect(node.querySelectorAll('.selection').length).toBe 1 + it "updates selections when the line height changes", -> + editor.setSelectedBufferRange([[1, 6], [1, 10]]) + component.setLineHeight(2) + selectionNode = node.querySelector('.region') + expect(selectionNode.offsetTop).toBe editor.getLineHeightInPixels() + describe "hidden input field", -> it "renders the hidden input field at the position of the last cursor if the cursor is on screen and the editor is focused", -> editor.setVerticalScrollMargin(0) diff --git a/src/selections-component.coffee b/src/selections-component.coffee index 80744755a..9a7122b9c 100644 --- a/src/selections-component.coffee +++ b/src/selections-component.coffee @@ -1,6 +1,6 @@ React = require 'react-atom-fork' {div} = require 'reactionary-atom-fork' -{isEqual} = require 'underscore-plus' +{isEqualForProperties} = require 'underscore-plus' SelectionComponent = require './selection-component' module.exports = @@ -22,4 +22,4 @@ SelectionsComponent = React.createClass @selectionRanges = {} shouldComponentUpdate: (newProps) -> - not isEqual(newProps.selectionScreenRanges, @props.selectionScreenRanges) + not isEqualForProperties(newProps, @props, 'selectionScreenRanges', 'lineHeightInPixels')