diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-10-01 20:46:20 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-10-01 20:46:20 +0200 |
commit | 347733804f8d61a01bc0a286f6f872f8dd14527d (patch) | |
tree | 055af65e51e4f2524a231d89c6a3cd83093f3a87 /src/windows.py | |
parent | d02c764c477d900487a97f648260612046257a17 (diff) | |
download | poezio-347733804f8d61a01bc0a286f6f872f8dd14527d.tar.gz poezio-347733804f8d61a01bc0a286f6f872f8dd14527d.tar.bz2 poezio-347733804f8d61a01bc0a286f6f872f8dd14527d.tar.xz poezio-347733804f8d61a01bc0a286f6f872f8dd14527d.zip |
Do not try to cycle completion on commands if there was only one possibily.
You can now see by the space appended at the end if it was the only one.
It lets you complete arguments without having to add a stupid space after the command name
Diffstat (limited to 'src/windows.py')
-rw-r--r-- | src/windows.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/windows.py b/src/windows.py index 03066857..fb99416c 100644 --- a/src/windows.py +++ b/src/windows.py @@ -122,7 +122,6 @@ class Win(object): self.move(y, x) next_attr_char = text.find('\x19') while next_attr_char != -1 and text: - log.debug('Addstr_Colored: [%s]' % text.replace('\x19', '\\x19')) if next_attr_char + 1 < len(text): attr_char = text[next_attr_char+1].lower() else: @@ -961,7 +960,7 @@ class Input(Win): if pos < len(self.text) and after.endswith(' ') and self.text[pos] == ' ': after = after[:-1] # remove the last space if we are already on a space if not self.last_completion: - space_before_cursor = self.text.rfind(' ', 0, pos-1) + space_before_cursor = self.text.rfind(' ', 0, pos) if space_before_cursor != -1: begin = self.text[space_before_cursor+1:pos] else: @@ -1043,7 +1042,8 @@ class Input(Win): return res if not key or len(key) > 1: return False # ignore non-handled keyboard shortcuts - self.reset_completion() + if reset: + self.reset_completion() self.text = self.text[:self.pos+self.line_pos]+key+self.text[self.pos+self.line_pos:] (y, x) = self._win.getyx() if x == self.width-1: |