summaryrefslogtreecommitdiff
path: root/Lib/idlelib/PyShell.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rw-r--r--Lib/idlelib/PyShell.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 5034417029..f81091bc4b 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -1091,11 +1091,12 @@ class PyShell(OutputWindow):
self.recall(self.text.get(next[0], next[1]), event)
return "break"
# No stdin mark -- just get the current line, less any prompt
- line = self.text.get("insert linestart", "insert lineend")
- last_line_of_prompt = sys.ps1.split('\n')[-1]
- if line.startswith(last_line_of_prompt):
- line = line[len(last_line_of_prompt):]
- self.recall(line, event)
+ indices = self.text.tag_nextrange("console", "insert linestart")
+ if indices and \
+ self.text.compare(indices[0], "<=", "insert linestart"):
+ self.recall(self.text.get(indices[1], "insert lineend"), event)
+ else:
+ self.recall(self.text.get("insert linestart", "insert lineend"), event)
return "break"
# If we're between the beginning of the line and the iomark, i.e.
# in the prompt area, move to the end of the prompt