completion: Fix initial _cursor_part value.

Fixes #749.
This commit is contained in:
Florian Bruhin 2015-06-16 13:22:55 +02:00
parent a024c14dd6
commit dfe98d1053

View File

@ -328,7 +328,7 @@ class Completer(QObject):
cursor_pos))
skip = 0
for i, part in enumerate(parts):
log.completion.vdebug("Checking part {}: {}".format(i, parts[i]))
log.completion.vdebug("Checking part {}: {!r}".format(i, parts[i]))
if not part:
skip += 1
continue
@ -349,6 +349,10 @@ class Completer(QObject):
log.completion.vdebug(
"Removing len({!r}) -> {} from cursor_pos -> {}".format(
part, len(part), cursor_pos))
else:
if i == 0:
# Initial `:` press without any text.
self._cursor_part = 0
else:
self._cursor_part = i - skip
if spaces: