diff --git a/spec/app/text-buffer-spec.coffee b/spec/app/text-buffer-spec.coffee index cb5395933..72233ba16 100644 --- a/spec/app/text-buffer-spec.coffee +++ b/spec/app/text-buffer-spec.coffee @@ -1251,11 +1251,14 @@ describe 'Buffer', -> describe "when the serialized buffer had unsaved changes", -> it "restores the previous unsaved state of the buffer", -> path = buffer.getPath() + previousText = buffer.getText() buffer.setText("abc") reloadBuffer() expect(serializedState.text).toBe "abc" expect(buffer.getPath()).toBe(path) expect(buffer.getText()).toBe("abc") + buffer.setText(previousText) + expect(buffer.isModified()).toBeFalsy() describe "when the serialized buffer was unsaved and had no path", -> it "restores the previous unsaved state of the buffer", -> diff --git a/src/app/text-buffer.coffee b/src/app/text-buffer.coffee index 3ebfda88e..36f93724c 100644 --- a/src/app/text-buffer.coffee +++ b/src/app/text-buffer.coffee @@ -41,11 +41,13 @@ class Buffer @setPath(path) if initialText? @setText(initialText) + @updateCachedDiskContents() else @reload() else @setText(initialText ? '') + @undoManager = new UndoManager(this) destroy: ->