Skip to content

Commit

Permalink
Merge pull request #5797 from csabella/issue1584
Browse files Browse the repository at this point in the history
PR: Don't add extra newline when using new file template
  • Loading branch information
ccordoba12 authored Dec 26, 2017
2 parents 2e95751 + ba1c56f commit 3648261
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spyder/plugins/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def __init__(self, parent, ignore_last_opened_files=False):
header = shebang + [
'# -*- coding: utf-8 -*-',
'"""', 'Created on %(date)s', '',
'@author: %(username)s', '"""', '']
'@author: %(username)s', '"""', '', '']
encoding.write(os.linesep.join(header), self.TEMPLATE_PATH, 'utf-8')

self.projects = None
Expand Down
3 changes: 2 additions & 1 deletion spyder/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,8 @@ def new(self, filename, encoding, text, default_content=False):
finfo = self.create_new_editor(filename, encoding, text,
set_current=False, new=True)
finfo.editor.set_cursor_position('eof')
finfo.editor.insert_text(os.linesep)
if not default_content:
finfo.editor.insert_text(os.linesep)
if default_content:
finfo.default = True
finfo.editor.document().setModified(False)
Expand Down

0 comments on commit 3648261

Please sign in to comment.