'Actually find the text, and handle highlight and selection.'

def _find(self, widget, direction):

    if (not self.searching):
        return
    self._clean()
    tosearch = self.search_entry.get_text()
    if (not tosearch):
        return
    positions = self.highlight(tosearch, 'yellow-background', self._matchCaseValue)
    if (not len(positions)):
        return
    cursor = self.textbuf.get_mark('insert')
    cursorIter = self.textbuf.get_iter_at_mark(cursor)
    for (ind, (iterini, iterfin)) in enumerate(positions):
        if (iterini.compare(cursorIter) >= 0):
            keypos = ind
            break
    else:
        keypos = 0
    if (direction == 'next'):
        keypos += 1
        if (keypos >= len(positions)):
            keypos = 0
    elif (direction == 'previous'):
        keypos -= 1
        if (keypos < 0):
            keypos = (len(positions) - 1)
    (iterini, iterfin) = positions[keypos]
    self.textbuf.select_range(iterini, iterfin)
    self.textview.scroll_to_iter(iterini, 0, False)
