Back to index

python3.2  3.2.2
Classes | Functions
idlelib.SearchEngine Namespace Reference

Classes

class  SearchEngine

Functions

def get
def search_reverse
def get_selection
def get_line_col

Function Documentation

def idlelib.SearchEngine.get (   root)

Definition at line 5 of file SearchEngine.py.

00005 
00006 def get(root):
00007     if not hasattr(root, "_searchengine"):
00008         root._searchengine = SearchEngine(root)
00009         # XXX This will never garbage-collect -- who cares
00010     return root._searchengine

Here is the caller graph for this function:

Definition at line 218 of file SearchEngine.py.

00218 
00219 def get_line_col(index):
00220     line, col = map(int, index.split(".")) # Fails on invalid index
00221     return line, col

Here is the caller graph for this function:

Definition at line 204 of file SearchEngine.py.

00204 
00205 def get_selection(text):
00206     try:
00207         first = text.index("sel.first")
00208         last = text.index("sel.last")
00209     except TclError:
00210         first = last = None
00211     if not first:
00212         first = text.index("insert")
00213     if not last:
00214         last = first
00215     return first, last
00216 
00217 # Helper to parse a text index into a (line, col) tuple.

Here is the caller graph for this function:

def idlelib.SearchEngine.search_reverse (   prog,
  chars,
  col 
)

Definition at line 185 of file SearchEngine.py.

00185 
00186 def search_reverse(prog, chars, col):
00187     m = prog.search(chars)
00188     if not m:
00189         return None
00190     found = None
00191     i, j = m.span()
00192     while i < col and j <= col:
00193         found = m
00194         if i == j:
00195             j = j+1
00196         m = prog.search(chars, j)
00197         if not m:
00198             break
00199         i, j = m.span()
00200     return found
00201 
00202 # Helper to get selection end points, defaulting to insert mark.
00203 # Return a tuple of indices ("line.col" strings).

Here is the caller graph for this function: