diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index a49088bfd..9fe7e94e0 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -2515,3 +2515,21 @@ describe "Editor", -> runs -> expect(editor.renderedLines.find('.line').text()).toBe 'hidden changes' + + it "redraws the editor when it is next reattached", -> + editor.attachToDom() + editor.hide() + editor.setText('hidden changes') + editor.setCursorBufferPosition([0,4]) + editor.detach() + + displayUpdatedHandler = jasmine.createSpy("displayUpdatedHandler") + editor.on 'editor:display-updated', displayUpdatedHandler + editor.show() + editor.attachToDom() + + waitsFor -> + displayUpdatedHandler.callCount is 1 + + runs -> + expect(editor.renderedLines.find('.line').text()).toBe 'hidden changes' diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 37e9610af..5eefef7bb 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -783,7 +783,9 @@ class Editor extends View updateDisplay: (options={}) -> return unless @attached and @activeEditSession return if @activeEditSession.destroyed - return unless @isVisible() + unless @isVisible() + @redrawOnReattach = true + return @updateRenderedLines() @highlightCursorLine()