'Find the end of the word to the right of 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.)'

def _get_word_end_cursor(self, position):

    document = self.document()
    cursor = self.textCursor()
    position = cursor.position()
    cursor.movePosition(QTextCursor.End)
    end = cursor.position()
    while ((position < end) and (not is_letter_or_number(document.characterAt(position)))):
        position += 1
    while ((position < end) and is_letter_or_number(document.characterAt(position))):
        position += 1
    cursor.setPosition(position)
    return cursor
