'Find the start of the word to the left 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_start_cursor(self, position):

    document = self.document()
    position -= 1
    while (position and (not is_letter_or_number(document.characterAt(position)))):
        position -= 1
    while (position and is_letter_or_number(document.characterAt(position))):
        position -= 1
    cursor = self.textCursor()
    cursor.setPosition((position + 1))
    return cursor
