Update selections when the line height changes

This commit is contained in:
Nathan Sobo
2014-06-02 12:48:19 +09:00
parent 77f78d0a11
commit 1cc5ef3479
2 changed files with 8 additions and 2 deletions

View File

@@ -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)

View File

@@ -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')