From 1b4426e3ba935b29fc6ee66d160263dcaf8344a2 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 11 Jun 2014 12:06:59 -0600 Subject: [PATCH] Don't pause overflowchanged events after React editor updates Fixes #2237 Previously, operations such as typing and scrolling were triggering overflowchanged events on the editor, which concerned me because we were performing lots of unnecessary measurements of the scroll view. Now that we draw extra lines above and below the visible screen row range, this doesn't happen, so we can remove this pausing code which was delaying the resizing of the editor in certain situations. --- src/editor-component.coffee | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index f682b878f..fc3621a6f 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -34,8 +34,6 @@ EditorComponent = React.createClass mouseWheelScreenRow: null mouseWheelScreenRowClearDelay: 150 scrollViewMeasurementRequested: false - overflowChangedEventsPaused: false - overflowChangedWhilePaused: false measureLineHeightAndDefaultCharWidthWhenShown: false inputEnabled: true @@ -176,7 +174,6 @@ EditorComponent = React.createClass @updateParentViewFocusedClassIfNeeded(prevState) @measureScrollbars() if @measuringScrollbars @measureLineHeightAndCharWidthsIfNeeded(prevState) - @pauseOverflowChangedEvents() @props.parentView.trigger 'editor:display-updated' requestUpdate: -> @@ -445,10 +442,7 @@ EditorComponent = React.createClass @pendingHorizontalScrollDelta = 0 onScrollViewOverflowChanged: -> - if @overflowChangedEventsPaused - @overflowChangedWhilePaused = true - else - @requestScrollViewMeasurement() + @requestScrollViewMeasurement() onWindowResize: -> @requestScrollViewMeasurement() @@ -674,18 +668,6 @@ EditorComponent = React.createClass # if the editor's content and dimensions require them to be visible. @requestUpdate() - pauseOverflowChangedEvents: -> - @overflowChangedEventsPaused = true - @resumeOverflowChangedEventsAfterDelay ?= debounce(@resumeOverflowChangedEvents, 500) - @resumeOverflowChangedEventsAfterDelay() - - resumeOverflowChangedEvents: -> - if @overflowChangedWhilePaused - @overflowChangedWhilePaused = false - @requestScrollViewMeasurement() - - resumeOverflowChangedEventsAfterDelay: null - clearMouseWheelScreenRow: -> if @mouseWheelScreenRow? @mouseWheelScreenRow = null