summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/iomenu.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/iomenu.py')
-rw-r--r--Lib/idlelib/iomenu.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py
index 327e885..af8159c 100644
--- a/Lib/idlelib/iomenu.py
+++ b/Lib/idlelib/iomenu.py
@@ -251,11 +251,17 @@ class IOBinding:
return False
def fixnewlines(self):
- "Return text with final \n if needed and os eols."
- if (self.text.get("end-2c") != '\n'
- and not hasattr(self.editwin, "interp")): # Not shell.
- self.text.insert("end-1c", "\n")
- text = self.text.get("1.0", "end-1c")
+ """Return text with os eols.
+
+ Add prompts if shell else final \n if missing.
+ """
+
+ if hasattr(self.editwin, "interp"): # Saving shell.
+ text = self.editwin.get_prompt_text('1.0', self.text.index('end-1c'))
+ else:
+ if self.text.get("end-2c") != '\n':
+ self.text.insert("end-1c", "\n") # Changes 'end-1c' value.
+ text = self.text.get('1.0', "end-1c")
if self.eol_convention != "\n":
text = text.replace("\n", self.eol_convention)
return text