From ba1c56fc259f26006054dd61244e9017082bd0e1 Mon Sep 17 00:00:00 2001 From: Cheryl Sabella Date: Sun, 19 Nov 2017 19:55:54 -0500 Subject: [PATCH] Don't add extra new line when using new file template. --- spyder/plugins/editor.py | 2 +- spyder/widgets/editor.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py index 1a4aa112acb..5a01e76e0f0 100644 --- a/spyder/plugins/editor.py +++ b/spyder/plugins/editor.py @@ -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 diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py index 2f0aeddc92b..f239ecf54dc 100644 --- a/spyder/widgets/editor.py +++ b/spyder/widgets/editor.py @@ -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)