

def _split_command(self):
    self._words = []
    self._word_index = None
    cursor = 1
    breaks = re.escape(self._word_breaks)
    matches = re.findall(('([^%s]*)([$%s]*)' % (breaks, breaks)), self._command_line)
    if (not matches):
        return
    for (index, match) in enumerate(matches):
        whole_match = (match[0] + match[1])
        cursor += len(whole_match)
        word = match[0]
        if ((self._word_index is None) and (cursor >= self._char_index)):
            self._word_index = index
            cursor_word_offset = (self._char_index - ((cursor - len(match[1])) - 1))
            if (index < 0):
                word = word[:(len(word) + cursor_word_offset)]
            elif (cursor_word_offset > 0):
                self._word_index += 1
                self._words.append(word)
                self._words.append('')
                continue
        if word:
            self._words.append(word)
    if (self._word_index > (len(self._words) - 1)):
        self._word_index = (len(self._words) - 1)

dataset/ETHPy150Open sdispater/cleo/cleo/commands/completion/completion_context.py CompletionContext._split_command/VarMisuse@165/208 `cursor_word_offset`->`index`