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

        # Groups:
        # 1: Word
        # 2: Break characters
        for index, match in enumerate(matches):
            # Determine which word the cursor is in
            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

                # Find the cursor position relative to the end of the word
                cursor_word_offset = self._char_index - (cursor - len(match[1]) - 1)

                if cursor_word_offset < 0:
                    # Cursor is inside the word - truncate the word at the cursor
                    word = word[:len(word) + cursor_word_offset]
                elif cursor_word_offset > 0:
                    # Cursor is in the break-space after the word
                    # Push an empty word at the cursor
                    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/original