diff --git a/src/app/buffer.coffee b/src/app/buffer.coffee index ccf5f255b..ef4468efd 100644 --- a/src/app/buffer.coffee +++ b/src/app/buffer.coffee @@ -14,6 +14,7 @@ class Buffer @idCounter = 1 undoManager: null modified: null + contentOnDisk: null modifiedOnDisk: null lines: null file: null @@ -30,7 +31,8 @@ class Buffer if path throw "Path '#{path}' does not exist" unless fs.exists(path) @setPath(path) - @setText(fs.read(@getPath())) + @contentOnDisk = fs.read(@getPath()) + @setText(@contentOnDisk) else @setText('') @@ -68,7 +70,8 @@ class Buffer @trigger "path-change", this reload: -> - @setText(fs.read(@file.getPath())) + @contentOnDisk = fs.read(@getPath()) + @setText(@contentOnDisk) @modified = false @modifiedOnDisk = false @@ -236,6 +239,7 @@ class Buffer @modified = false @modifiedOnDisk = false @setPath(path) + @contentOnDisk = @getText() @trigger 'after-save' @trigger 'buffer-change' @@ -249,7 +253,7 @@ class Buffer @modified contentDifferentOnDisk: -> - fs.read(@file.getPath()) != @getText() + @contentOnDisk != @getText() getAnchors: -> new Array(@anchors...)