Update editor when saving a new file with :w or :saveas

Fixes #156
This commit is contained in:
jazzpi 2016-08-10 01:29:21 +02:00
parent a59a6f9364
commit 2b9b2f26e5
2 changed files with 2 additions and 1 deletions

View file

@ -222,7 +222,7 @@ class Ex
if not saved and fullPath?
if not force and fs.existsSync(fullPath)
throw new CommandError("File exists (add ! to override)")
if saveas
if saveas or editor.getFileName() == null
editor = atom.workspace.getActiveTextEditor()
trySave(-> editor.saveAs(fullPath, editor)).then(deferred.resolve)
else

View file

@ -79,6 +79,7 @@ describe "the commands", ->
submitNormalModeInputText('write')
expect(fs.existsSync(filePath)).toBe(true)
expect(fs.readFileSync(filePath, 'utf-8')).toEqual('abc\ndef')
expect(editor.isModified()).toBe(false)
it "saves when a path is specified in the save dialog", ->
spyOn(atom, 'showSaveDialogSync').andReturn(undefined)