Example #1
0
    def __mark_occurences(self):
        """Marking occurences of the currently selected word"""
        self.__clear_occurence_markers()

        if not self.supported_language or self.hasSelectedText():
            return
            
        text = self.get_current_word()
        if text.isEmpty():
            return
        if (self.is_python() or self.is_cython()) and is_keyword(unicode(text)):
            return

        # Highlighting all occurences of word *text*
        ok = self.__find_first(text)
        self.occurences = []
        while ok:
            spos = self.SendScintilla(QsciScintilla.SCI_GETTARGETSTART)
            epos = self.SendScintilla(QsciScintilla.SCI_GETTARGETEND)
            self.SendScintilla(QsciScintilla.SCI_INDICATORFILLRANGE,
                               spos, epos-spos)
            ok = self.__find_next(text)
            line, _index = self.lineindex_from_position(spos)
            self.occurences.append(line)
        self.scrollflagarea.update()