code: def highlight_text(self, text, start, end):
          
  
          for rule in self.__rules:
              index = rule.pattern.indexIn(text, start)
              while index >= start and index < end:
                  length = rule.pattern.matchedLength()
                  format = self.formats.get_format(rule.name) or self.formats.get_format("default")
                  self.setFormat(index, min(length, end - index), format)
                  index = rule.pattern.indexIn(text, index + length)
          return True
docs: Highlights given text.
  
          :param text: Text.
          :type text: QString
          :param start: Text start index.
          :type start: int
          :param end: Text end index.
          :type end: int
          :return: Method success.
          :rtype: bool