Commit 03feef9c authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

M EditorWindow.py

M PyShell.py

Idlefork SF Bug 440383 - IDLE goes into beep loop
Fix loop in EditorWindow.newline_and_indent_event() and
in addition fix submission of >>> prompt to PyParse.Parser

Eliminate extra attribute EditorWindow.auto_indent
parent 762f576a
...@@ -1085,8 +1085,6 @@ class EditorWindow: ...@@ -1085,8 +1085,6 @@ class EditorWindow:
text.see("insert") text.see("insert")
text.undo_block_stop() text.undo_block_stop()
auto_indent = newline_and_indent_event
# Our editwin provides a is_char_in_string function that works # Our editwin provides a is_char_in_string function that works
# with a Tk text index, but PyParse only knows about offsets into # with a Tk text index, but PyParse only knows about offsets into
# a string. This builds a function for PyParse that accepts an # a string. This builds a function for PyParse that accepts an
......
...@@ -886,7 +886,7 @@ class PyShell(OutputWindow): ...@@ -886,7 +886,7 @@ class PyShell(OutputWindow):
self.text.insert("insert", "\n") self.text.insert("insert", "\n")
self.text.see("insert") self.text.see("insert")
else: else:
self.auto_indent(event) self.newline_and_indent_event(event)
return "break" return "break"
def enter_callback(self, event): def enter_callback(self, event):
...@@ -918,6 +918,11 @@ class PyShell(OutputWindow): ...@@ -918,6 +918,11 @@ class PyShell(OutputWindow):
# No stdin mark -- just get the current line # No stdin mark -- just get the current line
self.recall(self.text.get("insert linestart", "insert lineend")) self.recall(self.text.get("insert linestart", "insert lineend"))
return "break" return "break"
# If we're between the beginning of the line and the iomark, i.e.
# in the prompt area, complain.
if self.text.compare("insert", "<", "iomark"):
self.text.bell()
return "break"
# If we're in the current input and there's only whitespace # If we're in the current input and there's only whitespace
# beyond the cursor, erase that whitespace first # beyond the cursor, erase that whitespace first
s = self.text.get("insert", "end-1c") s = self.text.get("insert", "end-1c")
...@@ -926,7 +931,7 @@ class PyShell(OutputWindow): ...@@ -926,7 +931,7 @@ class PyShell(OutputWindow):
# If we're in the current input before its last line, # If we're in the current input before its last line,
# insert a newline right at the insert point # insert a newline right at the insert point
if self.text.compare("insert", "<", "end-1c linestart"): if self.text.compare("insert", "<", "end-1c linestart"):
self.auto_indent(event) self.newline_and_indent_event(event)
return "break" return "break"
# We're in the last line; append a newline and submit it # We're in the last line; append a newline and submit it
self.text.mark_set("insert", "end-1c") self.text.mark_set("insert", "end-1c")
...@@ -934,7 +939,7 @@ class PyShell(OutputWindow): ...@@ -934,7 +939,7 @@ class PyShell(OutputWindow):
self.text.insert("insert", "\n") self.text.insert("insert", "\n")
self.text.see("insert") self.text.see("insert")
else: else:
self.auto_indent(event) self.newline_and_indent_event(event)
self.text.tag_add("stdin", "iomark", "end-1c") self.text.tag_add("stdin", "iomark", "end-1c")
self.text.update_idletasks() self.text.update_idletasks()
if self.reading: if self.reading:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment