mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-11 04:48:44 +03:00
Saving a buffer sets its modified flag to false
This commit is contained in:
parent
8ab167fd00
commit
1fb8852fc3
@ -57,6 +57,17 @@ describe 'Buffer', ->
|
||||
buffer.insert([0,0], "hi")
|
||||
expect(buffer.isModified()).toBe true
|
||||
|
||||
it "returns false after modified buffer is saved", ->
|
||||
filePath = "/tmp/atom-tmp-file"
|
||||
buffer = new Buffer(filePath)
|
||||
expect(buffer.isModified()).toBe false
|
||||
|
||||
buffer.insert([0,0], "hi")
|
||||
expect(buffer.isModified()).toBe true
|
||||
|
||||
buffer.save()
|
||||
expect(buffer.isModified()).toBe false
|
||||
|
||||
describe '.deserialize(state, project)', ->
|
||||
project = null
|
||||
|
||||
|
@ -161,9 +161,10 @@ class Buffer
|
||||
@undoManager.redo()
|
||||
|
||||
save: ->
|
||||
if not @getPath() then throw new Error("Tried to save buffer with no file path")
|
||||
if not @getPath() then throw new Error("Can't save buffer with no file path")
|
||||
@trigger 'before-save'
|
||||
fs.write @getPath(), @getText()
|
||||
@modified = false
|
||||
@trigger 'after-save'
|
||||
|
||||
saveAs: (path) ->
|
||||
|
Loading…
Reference in New Issue
Block a user