From bef554709fca4d35abfb250a83c75a2717fe7df0 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 17 Apr 2014 16:03:26 -0600 Subject: [PATCH] Emit 'cursor:moved' event to update cursor position in status bar Emitting the event *before* update, rather than after. This is because we read from the DOM after update to measure new characters, which forces layout, so emitting the event after measuring forces another layout when the position is updated. --- src/editor-component.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index d1c64c829..a2cd1afee 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -75,6 +75,9 @@ EditorComponent = React.createClass componentWillUnmount: -> @getDOMNode().removeEventListener 'mousewheel', @onMouseWheel + componentWillUpdate: -> + @props.parentView.trigger 'cursor:moved' if @cursorsMoved + componentDidUpdate: -> @pendingChanges.length = 0 @cursorsMoved = false