summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-14 00:56:15 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-14 00:56:15 +0100
commitf0f9f670b9084761023ba9c594b97a0ad37581ed (patch)
treea6a3b72d68f0f5783875cd721ce5e6686009078a /src/windows.py
parent3ea5eb6163181ba016cfddcc616a171d7f309e76 (diff)
parent920c43dae25b06fd843dc8f8cbbf5e6bc5bf91c0 (diff)
downloadpoezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.tar.gz
poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.tar.bz2
poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.tar.xz
poezio-f0f9f670b9084761023ba9c594b97a0ad37581ed.zip
Merge branch 'master' of http://git.louiz.org/poezio
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py18
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):
"""