Merge pull request #158 from jazzpi/update-new-file-save
Update editor when saving a new file with `:w` or `:saveas`
This commit is contained in:
commit
683a592979
2 changed files with 2 additions and 1 deletions
|
|
@ -227,7 +227,7 @@ class Ex
|
||||||
if not saved and fullPath?
|
if not saved and fullPath?
|
||||||
if not force and fs.existsSync(fullPath)
|
if not force and fs.existsSync(fullPath)
|
||||||
throw new CommandError("File exists (add ! to override)")
|
throw new CommandError("File exists (add ! to override)")
|
||||||
if saveas
|
if saveas or editor.getFileName() == null
|
||||||
editor = atom.workspace.getActiveTextEditor()
|
editor = atom.workspace.getActiveTextEditor()
|
||||||
trySave(-> editor.saveAs(fullPath, editor)).then(deferred.resolve)
|
trySave(-> editor.saveAs(fullPath, editor)).then(deferred.resolve)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ describe "the commands", ->
|
||||||
submitNormalModeInputText('write')
|
submitNormalModeInputText('write')
|
||||||
expect(fs.existsSync(filePath)).toBe(true)
|
expect(fs.existsSync(filePath)).toBe(true)
|
||||||
expect(fs.readFileSync(filePath, 'utf-8')).toEqual('abc\ndef')
|
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", ->
|
it "saves when a path is specified in the save dialog", ->
|
||||||
spyOn(atom, 'showSaveDialogSync').andReturn(undefined)
|
spyOn(atom, 'showSaveDialogSync').andReturn(undefined)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue