diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-08-07 19:18:36 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-08-07 19:18:36 +0000 |
commit | 05928d592f76c7948a19981454d763feee51b2fb (patch) | |
tree | 8cd049bbc0d987fee219f51aa258be924274baab /src/gui.py | |
parent | eb36e08e11e8acac2db6a0422b5c9bd5ec9ab395 (diff) | |
download | poezio-05928d592f76c7948a19981454d763feee51b2fb.tar.gz poezio-05928d592f76c7948a19981454d763feee51b2fb.tar.bz2 poezio-05928d592f76c7948a19981454d763feee51b2fb.tar.xz poezio-05928d592f76c7948a19981454d763feee51b2fb.zip |
completion is now sorted by last_talked. fixed #1712
Diffstat (limited to 'src/gui.py')
-rw-r--r-- | src/gui.py | 27 |
1 files changed, 8 insertions, 19 deletions
@@ -264,28 +264,17 @@ class Gui(object): """ def compare_users(a, b): """ - Used to sort users by their availability + Used to sort users by their last_talked """ - if a.show == b.show: + if not a.last_talked and b.last_talked: return 0 - if a.show is None: + elif not b.last_talked and a.last_talked: + return 1 + if a.last_talked < b.last_talked: + return 1 + else: return -1 - return 1 - if len(self.window.input.text) == 0: - self.last_talked_completion() - else: - self.window.input.auto_completion([user.nick for user in sorted(self.current_room().users, compare_users)]) - - def last_talked_completion(self): - """ - If tab is used while the input is empty, insert the nickname - of the last person who spoke - """ - for msg in self.current_room().messages[::-1]: - if msg.nickname is not None and msg.nickname != self.current_room().own_nick: - self.window.input.text = msg.nickname+config.get('after_completion', ',')+" " - self.window.input.key_end() - return + self.window.input.auto_completion([user.nick for user in sorted(self.current_room().users, compare_users)]) def last_words_completion(self): """ |