(self)
return True
Check if the position is correct.
Check if the position is correct.
Check if the position is correct .
def is_position_correct(self):
        """Check if the position is correct."""

        if self.completion_position is None:
            return False

        cursor_position = self.textedit.textCursor().position()

        # Can only go forward from the data we have
        if cursor_position < self.completion_position:
            return False

        completion_text = self.textedit.get_current_word_and_position(
            completion=True)

        # If no text found, we must be at self.completion_position
        if completion_text is None:
            return self.completion_position == cursor_position

        completion_text, text_position = completion_text
        completion_text = str(completion_text)

        # The position of text must compatible with completion_position
        if not text_position <= self.completion_position <= (
                text_position + len(completion_text)):
            return False

        return True
def is_position_correct ( self ) : if self . completion_position is None : return False cursor_position = self . textedit . textCursor ( ) . position ( ) # Can only go forward from the data we have if cursor_position < self . completion_position : return False completion_text = self . textedit . get_current_word_and_position ( completion = True ) # If no text found, we must be at self.completion_position if completion_text is None : return self . completion_position == cursor_position completion_text , text_position = completion_text completion_text = str ( completion_text ) # The position of text must compatible with completion_position if not text_position <= self . completion_position <= ( text_position + len ( completion_text ) ) : return False return True