diff options
Diffstat (limited to 'src/windows.py')
-rw-r--r-- | src/windows.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/windows.py b/src/windows.py index d7471d40..bbae1ab7 100644 --- a/src/windows.py +++ b/src/windows.py @@ -940,7 +940,7 @@ class Input(Win): self.rewrite_text() return True - def auto_completion(self, word_list, add_after): + def auto_completion(self, word_list, add_after, quotify=True): """ Complete the input, from a list of words if add_after is None, we use the value defined in completion @@ -948,6 +948,10 @@ class Input(Win): completion (with no additional space) """ completion_type = config.get('completion', 'normal') + if quotify: + for i, word in enumerate(word_list[:]): + if ' ' in word: + word_list[i] = '"' + word + '"' if completion_type == 'shell' and self.text != '': self.shell_completion(word_list, add_after) else: @@ -975,10 +979,12 @@ class Input(Win): begin = self.text[space_before_cursor+1:pos] else: begin = self.text[:pos] - hit_list = [] # list of matching nicks + hit_list = [] # list of matching hits for word in word_list: if word.lower().startswith(begin.lower()): hit_list.append(word) + elif word.startswith('"') and word.lower()[1:].startswith(begin.lower()): + hit_list.append(word) if len(hit_list) == 0: return self.hit_list = hit_list @@ -990,18 +996,18 @@ class Input(Win): self.text = self.text[:pos-end] + self.text[pos:] pos -= end - nick = self.hit_list[0] # take the first hit - self.text = self.text[:pos] + nick + after + self.text[pos:] + hit = self.hit_list[0] # take the first hit + self.text = self.text[:pos] + hit + after + self.text[pos:] for i in range(end): try: self.key_left(reset=False) except: pass - for i in range(len(nick + after)): + for i in range(len(hit + after)): self.key_right(reset=False) self.rewrite_text() - self.last_completion = nick + self.last_completion = hit def shell_completion(self, word_list, after): """ |