[Python-checkins] CVS: python/dist/src/Tools/idle PyShell.py,1.25,1.26
Guido van Rossum
guido@cnri.reston.va.us
Tue, 7 Mar 2000 10:05:53 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Tools/idle
In directory eric:/projects/python/develop/guido/src/Tools/idle
Modified Files:
PyShell.py
Log Message:
If we're in the current input and there's only whitespace beyond the
cursor, erase that whitespace first. This avoids a particularly
confusing case where hitting Return at the end of the command didn't
do what it was expected to do -- because it wasn't considered to be at
the end of the command. Now it is.
Index: PyShell.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/PyShell.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** PyShell.py 2000/03/03 23:06:44 1.25
--- PyShell.py 2000/03/07 15:05:50 1.26
***************
*** 528,531 ****
--- 528,536 ----
self.recall(self.text.get("insert linestart", "insert lineend"))
return "break"
+ # If we're in the current input and there's only whitespace
+ # beyond the cursor, erase that whitespace first
+ s = self.text.get("insert", "end-1c")
+ if s and not string.strip(s):
+ self.text.delete("insert", "end-1c")
# If we're in the current input before its last line,
# insert a newline right at the insert point