diff options
author | Just van Rossum <just@lettererror.com> | 1999-12-23 15:46:57 (GMT) |
---|---|---|
committer | Just van Rossum <just@lettererror.com> | 1999-12-23 15:46:57 (GMT) |
commit | 24073eaf2b3f3a8e202288eedb55d5c73f36e041 (patch) | |
tree | 671a8931a82fa0c48bff10de0e4fcd9164f694b7 /Mac | |
parent | 121ee2722e510834bda99f8a48ccadc55d832e2a (diff) | |
download | cpython-24073eaf2b3f3a8e202288eedb55d5c73f36e041.zip cpython-24073eaf2b3f3a8e202288eedb55d5c73f36e041.tar.gz cpython-24073eaf2b3f3a8e202288eedb55d5c73f36e041.tar.bz2 |
changed the "method find" algorithm so the function/class/method popup menu also works with space-indented source files -- jvr
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Tools/IDE/PyEdit.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py index 63a21e7..7983705 100644 --- a/Mac/Tools/IDE/PyEdit.py +++ b/Mac/Tools/IDE/PyEdit.py @@ -586,6 +586,9 @@ class Editor(W.Window): def getclasslist(self): from string import find, strip + import re + methodRE = re.compile(r"\r[ \t]+def ") + findMethod = methodRE.search editor = self.editgroup.editor text = editor.get() list = [] @@ -613,10 +616,12 @@ class Editor(W.Window): append((pos + 7, classtag)) pos = 0 while 1: - pos = find(text, '\r\tdef ', pos + 1) - if pos < 0: + m = findMethod(text, pos + 1) + if m is None: break - append((pos + 6, methodtag)) + pos = m.regs[0][0] + #pos = find(text, '\r\tdef ', pos + 1) + append((m.regs[0][1], methodtag)) list.sort() classlist = [] methodlistappend = None |