summaryrefslogtreecommitdiffstats
path: root/Tools/idle/PyShell.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-01 19:52:34 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-01 19:52:34 (GMT)
commita6be3870b398a9b20a35b7302966605e56daa609 (patch)
treeca697d7925265c774f8bc38d8b234a0bfa03b0bd /Tools/idle/PyShell.py
parent8113cdc3a871392b97a4be79949edc8b26a23685 (diff)
downloadcpython-a6be3870b398a9b20a35b7302966605e56daa609.zip
cpython-a6be3870b398a9b20a35b7302966605e56daa609.tar.gz
cpython-a6be3870b398a9b20a35b7302966605e56daa609.tar.bz2
Tim Peters again:
[Tim, after adding some bracket smarts to AutoIndent.py] > ... > What it can't possibly do without reparsing large gobs of text is > suggest a reasonable indent level after you've *closed* a bracket > left open on some previous line. > ... The attached can, and actually fast enough to use -- most of the time. The code is tricky beyond belief to achieve that, but it works so far; e.g., return len(string.expandtabs(str[self.stmt_start : ^ indents to caret i], ^ indents to caret self.tabwidth)) + 1 ^ indents to caret It's about as smart as pymode now, wrt both bracket and backslash continuation rules. It does require reparsing large gobs of text, and if it happens to find something that looks like a "def" or "class" or sys.ps1 buried in a multiline string, but didn't suck up enough preceding text to see the start of the string, it's completely hosed. I can't repair that -- it's just too slow to reparse from the start of the file all the time. AutoIndent has grown a new num_context_lines tuple attribute that controls how far to look back, and-- like other params --this could/should be made user-overridable at startup and per-file on the fly.
Diffstat (limited to 'Tools/idle/PyShell.py')
0 files changed, 0 insertions, 0 deletions