summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-13 18:30:33 +0100
committermathieui <mathieui@mathieui.net>2011-11-13 18:37:17 +0100
commit587a74df6ea7b2e6bbca4c3e1eec5c096309cb7c (patch)
tree4abd2f9052070c0e1da21369e0f1b2dba9552a2d
parentc4f7d9b98a229ad52e834313ab93f0f9ebc77884 (diff)
downloadpoezio-587a74df6ea7b2e6bbca4c3e1eec5c096309cb7c.tar.gz
poezio-587a74df6ea7b2e6bbca4c3e1eec5c096309cb7c.tar.bz2
poezio-587a74df6ea7b2e6bbca4c3e1eec5c096309cb7c.tar.xz
poezio-587a74df6ea7b2e6bbca4c3e1eec5c096309cb7c.zip
Fix the completion with space-separated items
Fixes #2261
-rw-r--r--src/windows.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/windows.py b/src/windows.py
index d7471d40..c156863e 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -948,6 +948,9 @@ class Input(Win):
completion (with no additional space)
"""
completion_type = config.get('completion', 'normal')
+ 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 +978,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 +995,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):
"""