Commit ad30da80 authored by Just van Rossum's avatar Just van Rossum

changed the "method find" algorithm so the function/class/method popup menu...

changed the "method find" algorithm so the function/class/method popup menu also works with space-indented source files -- jvr
parent 2018382a
...@@ -586,6 +586,9 @@ class Editor(W.Window): ...@@ -586,6 +586,9 @@ class Editor(W.Window):
def getclasslist(self): def getclasslist(self):
from string import find, strip from string import find, strip
import re
methodRE = re.compile(r"\r[ \t]+def ")
findMethod = methodRE.search
editor = self.editgroup.editor editor = self.editgroup.editor
text = editor.get() text = editor.get()
list = [] list = []
...@@ -613,10 +616,12 @@ class Editor(W.Window): ...@@ -613,10 +616,12 @@ class Editor(W.Window):
append((pos + 7, classtag)) append((pos + 7, classtag))
pos = 0 pos = 0
while 1: while 1:
pos = find(text, '\r\tdef ', pos + 1) m = findMethod(text, pos + 1)
if pos < 0: if m is None:
break 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() list.sort()
classlist = [] classlist = []
methodlistappend = None methodlistappend = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment