summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-05-23 16:34:07 +0200
committermathieui <mathieui@mathieui.net>2012-05-23 16:34:07 +0200
commit32f8ada92deb7788a46b787ce08d97aa622140f2 (patch)
tree74128d33e6f6be64b69a3c35d1c6c60028b57b83
parent12bd9b589ca3ebc6ce6c9ae269006850a30afbaa (diff)
downloadpoezio-32f8ada92deb7788a46b787ce08d97aa622140f2.tar.gz
poezio-32f8ada92deb7788a46b787ce08d97aa622140f2.tar.bz2
poezio-32f8ada92deb7788a46b787ce08d97aa622140f2.tar.xz
poezio-32f8ada92deb7788a46b787ce08d97aa622140f2.zip
Put the personal words in the last words completion (M-/)
(instead of the normal completion)
-rw-r--r--data/default_config.cfg4
-rw-r--r--doc/en/configure.txt2
-rw-r--r--src/tabs.py24
3 files changed, 5 insertions, 25 deletions
diff --git a/data/default_config.cfg b/data/default_config.cfg
index 46c9f3b2..f4c5108f 100644
--- a/data/default_config.cfg
+++ b/data/default_config.cfg
@@ -99,8 +99,8 @@ after_completion = ,
# conversation window.
max_nick_length = 25
-# Words that you want to complete on normal completion, separated by a colon
-# (:).
+# Words that you want to complete on recent words completion,
+# separated by a colon (:).
# e.g. words = "anticonstitutionellement:I protest:I like bananas:"
words =
diff --git a/doc/en/configure.txt b/doc/en/configure.txt
index a2262c90..901ff9eb 100644
--- a/doc/en/configure.txt
+++ b/doc/en/configure.txt
@@ -135,7 +135,7 @@ section of this documentation.
*words*:: [empty]
Personal dictionary of the words you use often, that you want to complete
- through tab completion. They must be separated bu a colon (:). That
+ through recent words completion. They must be separated bu a colon (:). That
completion will work in chatrooms, private conversations, and direct
conversations.
diff --git a/src/tabs.py b/src/tabs.py
index 2bf0c216..5b6dda56 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -423,6 +423,7 @@ class ChatTab(Tab):
for word in txt.split():
if len(word) >= 4 and word not in words:
words.append(word)
+ words.extend([word for word in config.get('words', '').split(':') if word])
self.input.auto_completion(words, ' ', quotify=False)
def on_enter(self):
@@ -1129,9 +1130,6 @@ class MucTab(ChatTab):
compare_users = lambda x: x.last_talked
word_list = [user.nick for user in sorted(self.users, key=compare_users, reverse=True)\
if user.nick != self.own_nick]
- word_list.extend(config.get('words', '').split(':'))
- if '' in word_list:
- word_list.remove('')
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\
@@ -1586,9 +1584,6 @@ class PrivateTab(ChatTab):
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]
- word_list.extend(config.get('words', '').split(':'))
- if '' in word_list:
- word_list.remove('')
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\
@@ -2504,22 +2499,7 @@ class ConversationTab(ChatTab):
del ConversationTab.additional_informations[plugin_name]
def completion(self):
- if self.complete_commands(self.input):
- return
-
- word_list = config.get('words', '').split(':')
- if '' in word_list:
- word_list.remove('')
- 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)
+ self.complete_commands(self.input)
def command_say(self, line, attention=False):
msg = self.core.xmpp.make_message(self.get_name())