def _get_word_end_cursor(self, position):
        """ Find the end of the word to the right the given position. If a
            sequence of non-word characters precedes the first word, skip over
            them. (This emulates the behavior of bash, emacs, etc.)
        """
        document = self._control.document()
        cursor = self._control.textCursor()
        end_pos = self._get_end_pos()
        line_end_pos = self._get_line_end_pos()

        if position == end_pos:
            # Cursor is at the very end of the buffer
            return cursor
        elif position == line_end_pos:
            # Cursor is at the end of a line, move to the first
            # non-whitespace character of the next line
            cursor = self._control.textCursor()
            cursor.setPosition(position)
            cursor.movePosition(QtGui.QTextCursor.NextBlock)
            position = cursor.position() + len(self._continuation_prompt)
            while (
                position < end_pos and
                is_whitespace(document.characterAt(position))
            ):
                position += 1
            cursor.setPosition(position)
        else:
            if is_whitespace(document.characterAt(position)):
                # The next character is whitespace. If this is part of
                # indentation whitespace, skip to the first non-whitespace
                # character.
                is_indentation_whitespace = True
                back_pos = position - 1
                line_start_pos = self._get_line_start_pos()
                while back_pos >= line_start_pos:
                    if not is_whitespace(document.characterAt(back_pos)):
                        is_indentation_whitespace = False
                        break
                    back_pos -= 1
                if is_indentation_whitespace:
                    # Skip to the first non-whitespace character
                    while (
                        position < end_pos and
                        position < line_end_pos and
                        is_whitespace(document.characterAt(position))
                    ):
                        position += 1
                    cursor.setPosition(position)
                    return cursor

            while (
                position < end_pos and
                position < line_end_pos and
                not is_letter_or_number(document.characterAt(position))
            ):
                position += 1

            while (
                position < end_pos and
                position < line_end_pos and
                is_letter_or_number(document.characterAt(position))
            ):
                position += 1

            cursor.setPosition(position)
        return cursor
 Find the end of the word to the right the given position. If a
            sequence of non-word characters precedes the first word, skip over
            them. (This emulates the behavior of bash, emacs, etc.)
        
angrmanagement/vendor/qtconsole/console_widget.py