summaryrefslogtreecommitdiffstats
path: root/Tools/idle/PyShell.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-01 19:55:34 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-01 19:55:34 (GMT)
commitbbaba8540200dae111961f799f690b2a0e95dfd9 (patch)
tree0058abb344128b3d710df0c64f8c68fbdc5ee77a /Tools/idle/PyShell.py
parenta6be3870b398a9b20a35b7302966605e56daa609 (diff)
downloadcpython-bbaba8540200dae111961f799f690b2a0e95dfd9.zip
cpython-bbaba8540200dae111961f799f690b2a0e95dfd9.tar.gz
cpython-bbaba8540200dae111961f799f690b2a0e95dfd9.tar.bz2
Tim Peters again:
The new version (attached) is fast enough all the time in every real module I have <whew!>. You can make it slow by, e.g., creating an open list with 5,000 90-character identifiers (+ trailing comma) each on its own line, then adding an item to the end -- but that still consumes less than a second on my P5-166. Response time in real code appears instantaneous. Fixed some bugs. New feature: when hitting ENTER and the cursor is beyond the line's leading indentation, whitespace is removed on both sides of the cursor; before whitespace was removed only on the left; e.g., assuming the cursor is between the comma and the space: def something(arg1, arg2): ^ cursor to the left of here, and hit ENTER arg2): # new line used to end up here arg2): # but now lines up the way you expect New hack: AutoIndent has grown a context_use_ps1 Boolean config option, defaulting to 0 (false) and set to 1 (only) by PyShell. Reason: handling the fancy stuff requires looking backward for a parsing synch point; ps1 lines are the only sensible thing to look for in a shell window, but are a bad thing to look for in a file window (ps1 lines show up in my module docstrings often). PythonWin's shell should set this true too. Persistent problem: strings containing def/class can still screw things up completely. No improvement. Simplest workaround is on the user's head, and consists of inserting e.g. def _(): pass (or any other def/class) after the end of the multiline string that's screwing them up. This is especially irksome because IDLE's syntax coloring is *not* confused, so when this happens the colors don't match the indentation behavior they see.
Diffstat (limited to 'Tools/idle/PyShell.py')
-rw-r--r--Tools/idle/PyShell.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py
index bd095cf..a618ad1 100644
--- a/Tools/idle/PyShell.py
+++ b/Tools/idle/PyShell.py
@@ -291,7 +291,7 @@ class PyShell(OutputWindow):
__builtin__.quit = __builtin__.exit = "To exit, type Ctrl-D."
self.auto = self.extensions["AutoIndent"] # Required extension
- self.auto.config(usetabs=1, indentwidth=8)
+ self.auto.config(usetabs=1, indentwidth=8, context_use_ps1=1)
text = self.text
text.configure(wrap="char")