summaryrefslogtreecommitdiff
path: root/Mac/Tools/IDE/Wtext.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-02-21 13:54:31 +0000
committerJack Jansen <jack.jansen@cwi.nl>2001-02-21 13:54:31 +0000
commit9ad2752381b10cae83eb9e8044aa77dfd87d7039 (patch)
treee06b55db8ff39a445a6dcc83622fc229348d0582 /Mac/Tools/IDE/Wtext.py
parent2d0589be6739e15bc27ab8996ee0727a5a3dda51 (diff)
downloadcpython-git-9ad2752381b10cae83eb9e8044aa77dfd87d7039.tar.gz
Use re in stead of regex, so we get rid of the annoying warning during startup.
Diffstat (limited to 'Mac/Tools/IDE/Wtext.py')
-rw-r--r--Mac/Tools/IDE/Wtext.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/Mac/Tools/IDE/Wtext.py b/Mac/Tools/IDE/Wtext.py
index 8c1662d598..11b02768e6 100644
--- a/Mac/Tools/IDE/Wtext.py
+++ b/Mac/Tools/IDE/Wtext.py
@@ -603,9 +603,9 @@ class TextEditor(EditText):
self.drawselframe(1)
-import regex
-commentPat = regex.compile("[ \t]*\(#\)")
-indentPat = regex.compile("\t*")
+import re
+commentPat = re.compile("[ \t]*\(#\)")
+indentPat = re.compile("\t*")
class PyEditor(TextEditor):
@@ -659,9 +659,9 @@ class PyEditor(TextEditor):
snippet = self.getselectedtext()
lines = string.split(snippet, '\r')
for i in range(len(lines)):
- res = commentPat.match(lines[i]) >= 0
- if res > 0:
- pos = commentPat.regs[1][0]
+ m = commentPat.match(lines[i])
+ if m:
+ pos = m.start(1)
lines[i] = lines[i][:pos] + lines[i][pos+1:]
snippet = string.join(lines, '\r')
self.insert(snippet)
@@ -676,8 +676,9 @@ class PyEditor(TextEditor):
indent = 3000 # arbitrary large number...
for line in lines:
if string.strip(line):
- if indentPat.match(line):
- indent = min(indent, indentPat.regs[0][1])
+ m = indentPat.match(line)
+ if m:
+ indent = min(indent, m.regs[0][1])
else:
indent = 0
break