Fix completion

This commit is contained in:
Florian Bruhin 2014-11-09 18:12:36 +01:00
parent 2b8d6c5dd7
commit 61943b5a77

View File

@ -211,10 +211,13 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
including a trailing space and we shouldn't continue including a trailing space and we shouldn't continue
completing the current item. completing the current item.
""" """
parts = self.split(keep=True) parts = self.split()
log.completion.debug("changing part {} to '{}'".format( log.completion.debug("changing part {} to '{}'".format(
self._cursor_part, newtext)) self._cursor_part, newtext))
try:
parts[self._cursor_part] = newtext parts[self._cursor_part] = newtext
except IndexError:
parts.append(newtext)
# We want to place the cursor directly after the part we just changed. # We want to place the cursor directly after the part we just changed.
cursor_str = self.prefix() + ' '.join(parts[:self._cursor_part + 1]) cursor_str = self.prefix() + ' '.join(parts[:self._cursor_part + 1])
if immediate: if immediate: