summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-05-19 22:28:30 +0200
committermathieui <mathieui@mathieui.net>2012-05-19 22:28:30 +0200
commit51c788ad96703d215942499ffefe6fdc98326b6b (patch)
tree9949de828ff953618e3e8269600f61d659cc1e2b
parentdc8b39709ffa2746c6c8ae2c03fad4818a08ba4b (diff)
downloadpoezio-51c788ad96703d215942499ffefe6fdc98326b6b.tar.gz
poezio-51c788ad96703d215942499ffefe6fdc98326b6b.tar.bz2
poezio-51c788ad96703d215942499ffefe6fdc98326b6b.tar.xz
poezio-51c788ad96703d215942499ffefe6fdc98326b6b.zip
Allow nick completion in the Private tabs as well.
-rw-r--r--src/tabs.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/tabs.py b/src/tabs.py
index 61b322a0..2126cef9 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -8,9 +8,9 @@
"""
a Tab object is a way to organize various Windows (see windows.py)
around the screen at once.
-A tab is then composed of multiple Buffer.
+A tab is then composed of multiple Buffers.
Each Tab object has different refresh() and resize() methods, defining how its
-Windows are displayed, resized, etc
+Windows are displayed, resized, etc.
"""
MIN_WIDTH = 42
@@ -1566,7 +1566,26 @@ class PrivateTab(ChatTab):
self.parent_muc.privates.remove(self)
def completion(self):
- self.complete_commands(self.input)
+ """
+ Called when Tab is pressed, complete the nickname in the input
+ """
+ if self.complete_commands(self.input):
+ return
+
+ # If we are not completing a command or a command's argument, complete a nick
+ compare_users = lambda x: x.last_talked
+ word_list = [user.nick for user in sorted(self.parent_muc.users, key=compare_users, reverse=True)\
+ if user.nick != self.own_nick]
+ after = config.get('after_completion', ',')+" "
+ input_pos = self.input.pos + self.input.line_pos
+ if ' ' not in self.input.get_text()[:input_pos] or (self.input.last_completion and\
+ self.input.get_text()[:input_pos] == self.input.last_completion + after):
+ add_after = after
+ else:
+ add_after = ''
+ self.input.auto_completion(word_list, add_after, quotify=False)
+ empty_after = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//'))
+ self.send_composing_chat_state(empty_after)
def command_say(self, line, attention=False):
if not self.on: