 
   isModified: -> @cachedContents isnt @getCacheContent()
 
-  emitModifiedStatusChange: (modified=true) ->
-    return if modified is @modified
-
-    @modified = modified
+  emitModifiedStatusChange: ->
+    modified = @isModified()
+    return if @lastModified is modified
+
     @emitter.emit 'did-change-modified', modified
+    @lastModified = modified
 
   isDestroyed: -> @destroyed
 
   save: ->
-    return unless @modified
+    return unless @lastModified
 
     @emitter.emit 'will-save', this
 
     if @saveHandler?
-      result = @saveHandler(this)
-      if result instanceof Promise
-        result.then =>
-          @emitModifiedStatusChange(false)
+      saved = @saveHandler(this)
+      if saved instanceof Promise
+        saved.then =>
+          @emitModifiedStatusChange()
           @updateCachedContents()
           @emitter.emit 'did-save', this
-        result.catch (reason) ->
+        saved.catch (reason) ->
           console.error reason
       else
-        @emitModifiedStatusChange(!result)
-
-        unless @modified
+        @emitModifiedStatusChange()
+
+        if saved
           @updateCachedContents()
           @emitter.emit 'did-save', this
     else
-      @emitModifiedStatusChange(false)
+      @emitModifiedStatusChange()
       @updateCachedContents()
       @emitter.emit 'did-save', this
 

    @columns = []
    @rows = []
    @emitter = new Emitter
    @modified = false

  destroy: ->
    return if @destroyed

    @cachedContents = @getCacheContent()

  getCacheContent: ->
    res = [@columns].concat(@rows).join('\n')

  #    ######## ##     ## ######## ##    ## ########  ######
  #    ##       ##     ## ##       ###   ##    ##    ##    ##
