docs: def search_text(self, text_cursor, search_txt, search_flags):
          """
          Searches a text in a text document.
  
          :param text_cursor: Current text cursor
          :param search_txt: Text to search
          :param search_flags: QTextDocument.FindFlags
          :returns: the list of occurrences, the current occurrence index
          :rtype: tuple([], int)
  
          """
          def compare_cursors(cursor_a, cursor_b):
              """
              Compares two QTextCursor
  
              :param cursor_a: cursor a
              :param cursor_b: cursor b
  
              :returns; True if both cursor are identical (same position, same
                  selection)
              """
              return (cursor_b.selectionStart() >= cursor_a.selectionStart() and
                      cursor_b.selectionEnd() <= cursor_a.selectionEnd())
  
          text_document = self._editor.document()
          occurrences = []
          index = -1
          cursor = text_document.find(search_txt, 0, search_flags)
          original_cursor = text_cursor
          while not cursor.isNull():
              if compare_cursors(cursor, original_cursor):
                  index = len(occurrences)
              occurrences.append((cursor.selectionStart(),
                                  cursor.selectionEnd()))
              cursor.setPosition(cursor.position() + 1)
              cursor = text_document.find(search_txt, cursor, search_flags)
          return occurrences, index