Completion logging improvements

This commit is contained in:
Florian Bruhin 2014-06-03 06:58:18 +02:00
parent 9bee827d52
commit 98b967abaa

View File

@ -103,10 +103,9 @@ class Command(MinimalLineEdit):
# When only ":" is entered, we already have one imaginary part, # When only ":" is entered, we already have one imaginary part,
# which just is empty at the moment. # which just is empty at the moment.
return [''] return ['']
logger.debug("Splitting '{}'".format(text))
manager = CommandManager() manager = CommandManager()
parts = manager.parse(text, fallback=True, alias_no_args=False) parts = manager.parse(text, fallback=True, alias_no_args=False)
logger.debug("Split parts: {}".format(parts)) logger.debug("Splitting '{}' -> {}".format(text, parts))
return parts return parts
@pyqtSlot() @pyqtSlot()
@ -124,6 +123,7 @@ class Command(MinimalLineEdit):
if old_cursor_part != i: if old_cursor_part != i:
self.update_completion.emit(self.prefix, self.parts, self.update_completion.emit(self.prefix, self.parts,
self.cursor_part) self.cursor_part)
logger.debug("Cursor part: {}".format(i))
return return
cursor_pos -= (len(part) + 1) # FIXME are spaces always 1 char? cursor_pos -= (len(part) + 1) # FIXME are spaces always 1 char?
return None return None
@ -158,8 +158,8 @@ class Command(MinimalLineEdit):
completing the current item. completing the current item.
""" """
parts = self.parts[:] parts = self.parts[:]
logger.debug("parts: {}, changing {} to '{}'".format( logger.debug("changing part {} to '{}'".format(self.cursor_part,
parts, self.cursor_part, newtext)) newtext))
parts[self.cursor_part] = newtext parts[self.cursor_part] = 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])