Skip to content

Commit

Permalink
Allow new files to be saved before modifing them.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaverde committed Jan 23, 2017
1 parent c907694 commit 4ee5342
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spyder/plugins/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ def refresh_file_dependent_actions(self):
def refresh_save_all_action(self):
"""Enable 'Save All' if there are files to be saved"""
editorstack = self.get_current_editorstack()
state = any(finfo.editor.document().isModified()
state = any(finfo.editor.document().isModified() or finfo.newly_created
for finfo in editorstack.data)
self.save_all_action.setEnabled(state)

Expand Down
5 changes: 3 additions & 2 deletions spyder/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,8 @@ def save(self, index=None, force=False):
index = self.get_stack_index()

finfo = self.data[index]
if not finfo.editor.document().isModified() and not force:
if not (finfo.editor.document().isModified() or
finfo.newly_created) and not force:
return True
if not osp.isfile(finfo.filename) and not force:
# File has not been saved yet
Expand Down Expand Up @@ -1662,7 +1663,7 @@ def modification_changed(self, state=None, index=None, editor_id=None):
return
finfo = self.data[index]
if state is None:
state = finfo.editor.document().isModified()
state = finfo.editor.document().isModified() or finfo.newly_created
self.set_stack_title(index, state)
# Toggle save/save all actions state
self.save_action.setEnabled(state)
Expand Down

0 comments on commit 4ee5342

Please sign in to comment.