Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit aada661

Browse files
committed
Use active pane to save untitled file
Fixes: #143
1 parent 8958308 commit aada661

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/whitespace.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@ module.exports = class Whitespace {
2525

2626
if (editor) {
2727
this.ignore = true
28-
await editor.save()
28+
editor.getPath() ? await editor.save() : atom.workspace.getCenter().getActivePane().saveActiveItemAs()
2929
this.ignore = false
3030
}
3131
},
3232

33-
'whitespace:save-without-trailing-whitespace': () => {
33+
'whitespace:save-without-trailing-whitespace': async () => {
3434
let editor = atom.workspace.getActiveTextEditor()
3535

3636
if (editor) {
3737
this.removeTrailingWhitespace(editor, editor.getGrammar().scopeName)
38-
editor.save()
38+
console.log(editor.getPath())
39+
editor.getPath() ? await editor.save() : atom.workspace.getCenter().getActivePane().saveActiveItemAs()
3940
}
4041
},
4142

0 commit comments

Comments
 (0)