diff --git a/lib/ex.coffee b/lib/ex.coffee index b221a3b..7c9a6fa 100644 --- a/lib/ex.coffee +++ b/lib/ex.coffee @@ -227,7 +227,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 diff --git a/spec/ex-commands-spec.coffee b/spec/ex-commands-spec.coffee index 08237e3..1b1178e 100644 --- a/spec/ex-commands-spec.coffee +++ b/spec/ex-commands-spec.coffee @@ -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)