diff options
author | mathieui <mathieui@mathieui.net> | 2018-07-22 00:06:30 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-07-22 00:06:30 +0200 |
commit | 3cb8e33f938db6bb6e86dd349f8b56676b83556f (patch) | |
tree | 0863abcd1f8d446a6c5797f0e1795a9620605a73 | |
parent | 7fd672caca8843a865f67d9befd814603447a1d7 (diff) | |
download | poezio-3cb8e33f938db6bb6e86dd349f8b56676b83556f.tar.gz poezio-3cb8e33f938db6bb6e86dd349f8b56676b83556f.tar.bz2 poezio-3cb8e33f938db6bb6e86dd349f8b56676b83556f.tar.xz poezio-3cb8e33f938db6bb6e86dd349f8b56676b83556f.zip |
Do not complete fulljids in /message (Fix #3405)
-rw-r--r-- | poezio/core/completions.py | 19 | ||||
-rw-r--r-- | poezio/core/core.py | 4 |
2 files changed, 11 insertions, 12 deletions
diff --git a/poezio/core/completions.py b/poezio/core/completions.py index 29fcd24e..b283950e 100644 --- a/poezio/core/completions.py +++ b/poezio/core/completions.py @@ -256,16 +256,15 @@ class CompletionCore: n = the_input.get_argument_position(quoted=True) if n >= 2: return False - l = [] - for jid in roster.jids(): - if len(roster[jid]): - l.append(jid) - for resource in roster[jid].resources: - l.append(resource.jid) - for jid in roster.jids(): - if not len(roster[jid]): - l.append(jid) - return Completion(the_input.new_completion, l, 1, '', quotify=True) + online = [] + offline = [] + for jid in sorted(roster.jids()): + if len(roster[jid]) > 0: + online.append(jid) + else: + offline.append(jid) + return Completion( + the_input.new_completion, online + offline, 1, '', quotify=True) def invite(self, the_input): """Completion for /invite""" diff --git a/poezio/core/core.py b/poezio/core/core.py index d9ac45a0..480bf814 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -1099,8 +1099,8 @@ class Core: for state in states: for tab in tab_refs[state]: - if (tab.nb < self.tabs.current_index and - tab_refs[state][-1].nb > self.tabs.current_index): + if (tab.nb < self.tabs.current_index + and tab_refs[state][-1].nb > self.tabs.current_index): continue self.command.win(str(tab.nb)) return |