From a147dc01d76a1827488447e50c2624297fb19e55 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki & Nathan Sobo Date: Fri, 16 Aug 2013 11:30:37 -0700 Subject: [PATCH] Clear undo stack after setting initial buffer text --- spec/app/text-buffer-spec.coffee | 6 ++++++ src/app/text-buffer.coffee | 1 + vendor/telepath | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/app/text-buffer-spec.coffee b/spec/app/text-buffer-spec.coffee index 5514dd8ee..f8550b3d0 100644 --- a/spec/app/text-buffer-spec.coffee +++ b/spec/app/text-buffer-spec.coffee @@ -28,6 +28,12 @@ describe 'TextBuffer', -> buffer = project.bufferForPath(filePath) expect(buffer.getText()).toBe fsUtils.read(filePath) + it "does not allow the initial state of the buffer to be undone", -> + filePath = require.resolve 'fixtures/sample.txt' + buffer = project.bufferForPath(filePath) + buffer.undo() + expect(buffer.getText()).toBe fsUtils.read(filePath) + describe "when no file exists for the path", -> it "is modified and is initially empty", -> filePath = "does-not-exist.txt" diff --git a/src/app/text-buffer.coffee b/src/app/text-buffer.coffee index e3b31b8bd..2a975e7c5 100644 --- a/src/app/text-buffer.coffee +++ b/src/app/text-buffer.coffee @@ -59,6 +59,7 @@ class TextBuffer if fsUtils.exists(@getPath()) @updateCachedDiskContents() @reload() if reloadFromDisk and @isModified() + @text.clearUndoStack() ### Internal ### diff --git a/vendor/telepath b/vendor/telepath index 79ff8d15c..93ceddf89 160000 --- a/vendor/telepath +++ b/vendor/telepath @@ -1 +1 @@ -Subproject commit 79ff8d15c8e93ded1f3bf71547587dc5bb095aab +Subproject commit 93ceddf89e6a6b530105cd3df54b15ad0f7251af