diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2002-09-15 21:31:30 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2002-09-15 21:31:30 (GMT) |
commit | 1b3c26998e0f8b6975f7bbccf043c0afe398f151 (patch) | |
tree | e921c39deec0587841d4b957d1b68e492bcc5c57 /Lib/idlelib | |
parent | 87807a66c4c911a58098dae037c176204f33b6d6 (diff) | |
download | cpython-1b3c26998e0f8b6975f7bbccf043c0afe398f151.zip cpython-1b3c26998e0f8b6975f7bbccf043c0afe398f151.tar.gz cpython-1b3c26998e0f8b6975f7bbccf043c0afe398f151.tar.bz2 |
Merge Py Idle's changes to AutoIndent.py into EditorWindow.py since
EditorWindow has incorporated AutoIndent
Rev 1.17
classifyws(): Fix a "/" to work under -Qnew (as well as without it).
Bugfix candidate!
Rev 1.18
(Already merged)
Rev 1.19
smart_backspace_event(): remove now-pointless int() call.
Bugfix candidate: the current state of AutoIdent.py should be in 2.2.1.
Rev 1.20
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 01deba0..b9e44e1 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1,6 +1,5 @@ import sys import os -import string import re import imp from Tkinter import * @@ -913,15 +912,15 @@ class EditorWindow: return "break" # Ick. It may require *inserting* spaces if we back up over a # tab character! This is written to be clear, not fast. - expand, tabwidth = string.expandtabs, self.tabwidth - have = len(expand(chars, tabwidth)) + tabwidth = self.tabwidth + have = len(chars.expandtabs(tabwidth)) assert have > 0 want = ((have - 1) // self.indentwidth) * self.indentwidth ncharsdeleted = 0 while 1: chars = chars[:-1] ncharsdeleted = ncharsdeleted + 1 - have = len(expand(chars, tabwidth)) + have = len(chars.expandtabs(tabwidth)) if have <= want or chars[-1] not in " \t": break text.undo_block_start() @@ -955,8 +954,7 @@ class EditorWindow: if self.usetabs: pad = '\t' else: - effective = len(string.expandtabs(prefix, - self.tabwidth)) + effective = len(prefix.expandtabs(self.tabwidth)) n = self.indentwidth pad = ' ' * (n - effective % n) text.insert("insert", pad) @@ -1121,7 +1119,7 @@ class EditorWindow: head, tail, chars, lines = self.get_region() tabwidth = self._asktabwidth() for pos in range(len(lines)): - lines[pos] = string.expandtabs(lines[pos], tabwidth) + lines[pos] = lines[pos].expandtabs(tabwidth) self.set_region(head, tail, chars, lines) def toggle_tabs_event(self, event): @@ -1162,12 +1160,12 @@ class EditorWindow: head = text.index("insert linestart") tail = text.index("insert lineend +1c") chars = text.get(head, tail) - lines = string.split(chars, "\n") + lines = chars.split("\n") return head, tail, chars, lines def set_region(self, head, tail, chars, lines): text = self.text - newchars = string.join(lines, "\n") + newchars = "\n".join(lines) if newchars == chars: text.bell() return |