Preserve buffer contents for unsaved files when reloading

This commit is contained in:
Mutwin Kraus
2013-03-25 20:16:22 +01:00
committed by Nathan Sobo
parent 9a8fd062c4
commit 693d8258ad
4 changed files with 16 additions and 1 deletions

View File

@@ -2059,6 +2059,10 @@ describe "EditSession", ->
editSession.setCursorScreenPosition([0, 1])
editSession.buffer.reload()
expect(editSession.getCursorScreenPosition()).toEqual [0,1]
it "preserves the current state if the file was not saved yet", ->
editSession = project.buildEditSessionFromState('test', autoIndent: false)
editSession = EditSession.deserialize(editSession.serialize())
expect(editSession.buffer.getText()).toBe('test')
describe "when the 'grammars-loaded' event is triggered on the syntax global", ->
it "reloads the edit session's grammar and re-tokenizes the buffer if it changes", ->