Don't allow :edit without a filename for new files. Closes #73.

This commit is contained in:
Matthew Leeds 2015-07-29 00:24:28 -05:00
parent da8405b387
commit be57a66916

View file

@ -112,6 +112,8 @@ class Ex
if filePath.indexOf(' ') isnt -1 if filePath.indexOf(' ') isnt -1
throw new CommandError('Only one file name allowed') throw new CommandError('Only one file name allowed')
buffer = atom.workspace.getActiveTextEditor().buffer buffer = atom.workspace.getActiveTextEditor().buffer
if filePath is '' and not buffer.getPath()?
throw new CommandError('Nothing to edit')
filePath = buffer.getPath() if filePath is '' filePath = buffer.getPath() if filePath is ''
buffer.setPath(getFullPath(filePath)) buffer.setPath(getFullPath(filePath))
buffer.load() buffer.load()