diff options
author | mathieui <mathieui@mathieui.net> | 2013-08-02 22:00:53 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-08-02 22:00:53 +0200 |
commit | 6fbb2f85938884286de4f4c0610b2389fcde4460 (patch) | |
tree | f1daf4f99b5aab830f55882619558bf9f33a3c3e /src/windows.py | |
parent | bb59771d9962dcd69c29b008031fd4ae9002915d (diff) | |
download | poezio-6fbb2f85938884286de4f4c0610b2389fcde4460.tar.gz poezio-6fbb2f85938884286de4f4c0610b2389fcde4460.tar.bz2 poezio-6fbb2f85938884286de4f4c0610b2389fcde4460.tar.xz poezio-6fbb2f85938884286de4f4c0610b2389fcde4460.zip |
Fix #2317 (/join completion is broken)
Also add an override parameter to new_completion so that the
completion does not care if the list matches the previous input
or not.
Diffstat (limited to 'src/windows.py')
-rw-r--r-- | src/windows.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/windows.py b/src/windows.py index b35ad4ba..96c7ee1c 100644 --- a/src/windows.py +++ b/src/windows.py @@ -1383,7 +1383,7 @@ class Input(Win): self.normal_completion(word_list, add_after) return True - def new_completion(self, word_list, argument_position=-1, add_after='', quotify=True): + def new_completion(self, word_list, argument_position=-1, add_after='', quotify=True, override=False): """ Complete the argument at position ``argument_postion`` in the input. If ``quotify`` is ``True``, then the completion will operate on block of words @@ -1403,11 +1403,11 @@ class Input(Win): if argument_position == 0: self._new_completion_first(word_list) else: - self._new_completion_args(word_list, argument_position, add_after, quotify) + self._new_completion_args(word_list, argument_position, add_after, quotify, override) self.rewrite_text() return True - def _new_completion_args(self, word_list, argument_position=-1, add_after='', quoted=True): + def _new_completion_args(self, word_list, argument_position=-1, add_after='', quoted=True, override=False): """ Case for completing arguments with position ≠ 0 """ @@ -1432,11 +1432,13 @@ class Input(Win): if self.last_completion is not None: self.hit_list.append(self.hit_list.pop(0)) else: - hit_list = [] - for word in word_list: - if word.lower().startswith(current_l): - hit_list.append(word) - + if override: + hit_list = word_list + else: + hit_list = [] + for word in word_list: + if word.lower().startswith(current_l): + hit_list.append(word) if not hit_list: return self.hit_list = hit_list |