diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index f9effd047..31467bed4 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -67,6 +67,15 @@ describe "TextEditorComponent", -> expect(nextAnimationFrame).not.toThrow() + it "doesn't update when an animation frame was requested but the component got destroyed before its delivery", -> + editor.setText("You shouldn't see this update.") + expect(nextAnimationFrame).not.toBe(noAnimationFrame) + + component.destroy() + nextAnimationFrame() + + expect(component.lineNodeForScreenRow(0).textContent).not.toBe("You shouldn't see this update.") + describe "line rendering", -> expectTileContainsRow = (tileNode, screenRow, {top}) -> lineNode = tileNode.querySelector("[data-screen-row='#{screenRow}']") diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index e0ab143c5..66996a996 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -195,7 +195,7 @@ class TextEditorComponent @updateRequested = true atom.views.updateDocument => @updateRequested = false - @updateSync() if @editor.isAlive() + @updateSync() if @canUpdate() atom.views.readDocument(@readAfterUpdateSync) canUpdate: ->