diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-09-11 15:45:28 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-09-11 15:45:28 +0000 |
commit | 508bf5d5614936a270d73a4e2f8fd5f468c5e0cb (patch) | |
tree | ae210a45a2aeefa45fd9d0f7b5ce468449840fb2 /src/window.py | |
parent | 374ab23b42113453beff1010a2354697d16552b7 (diff) | |
download | poezio-508bf5d5614936a270d73a4e2f8fd5f468c5e0cb.tar.gz poezio-508bf5d5614936a270d73a4e2f8fd5f468c5e0cb.tar.bz2 poezio-508bf5d5614936a270d73a4e2f8fd5f468c5e0cb.tar.xz poezio-508bf5d5614936a270d73a4e2f8fd5f468c5e0cb.zip |
don't add the ',' after a last-word completion.
Diffstat (limited to 'src/window.py')
-rw-r--r-- | src/window.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/window.py b/src/window.py index 5d239c96..8eff8c15 100644 --- a/src/window.py +++ b/src/window.py @@ -586,7 +586,7 @@ class Input(Win): if reset: self.rewrite_text() - def auto_completion(self, user_list): + def auto_completion(self, user_list, add_after=True): """ Complete the nickname """ @@ -594,9 +594,9 @@ class Input(Win): return # we don't complete if cursor is not at the end of line completion_type = config.get('completion', 'normal') if completion_type == 'shell' and self.text != '': - self.shell_completion(user_list) + self.shell_completion(user_list, add_after) else: - self.normal_completion(user_list) + self.normal_completion(user_list, add_after) def reset_completion(self): """ @@ -605,12 +605,12 @@ class Input(Win): self.hit_list = [] self.last_completion = None - def normal_completion(self, user_list): + def normal_completion(self, user_list, add_after): """ Normal completion """ - if " " not in self.text.strip() or\ - self.last_completion and self.text == self.last_completion+config.get('after_completion', ',')+" ": + if add_after and (" " not in self.text.strip() or\ + self.last_completion and self.text == self.last_completion+config.get('after_completion', ',')+" "): after = config.get('after_completion', ',')+" " #if " " in self.text.strip() and (not self.last_completion or ' ' in self.last_completion): else: @@ -640,11 +640,11 @@ class Input(Win): self.text += nick +after self.key_end(False) - def shell_completion(self, user_list): + def shell_completion(self, user_list, add_after): """ Shell-like completion """ - if " " in self.text.strip(): + if " " in self.text.strip() or not add_after: after = " " # don't put the "," if it's not the begining of the sentence else: after = config.get('after_completion', ',')+" " |