add a space at the end of command when we use completion

This commit is contained in:
Yann Leboulanger 2005-06-20 08:14:06 +00:00
parent 751ae44b7c
commit 829fb64dea
1 changed files with 4 additions and 3 deletions

View File

@ -393,8 +393,10 @@ class GroupchatWindow(chat.Chat):
if not self.last_key_tabs[room_jid]: # if we are nick cycling, last char will always be space if not self.last_key_tabs[room_jid]: # if we are nick cycling, last char will always be space
return False return False
splitted_text = text.split()
# command completion # command completion
if text.startswith('/') and len(text.split()) == 1: if text.startswith('/') and len(splitted_text) == 1:
text = splitted_text[0]
if len(text) == 1: # user wants to cycle all commands if len(text) == 1: # user wants to cycle all commands
self.cmd_hits[room_jid] = self.muc_cmds self.cmd_hits[room_jid] = self.muc_cmds
else: else:
@ -411,12 +413,11 @@ class GroupchatWindow(chat.Chat):
if len(self.cmd_hits[room_jid]): if len(self.cmd_hits[room_jid]):
message_buffer.delete(start_iter, end_iter) message_buffer.delete(start_iter, end_iter)
message_buffer.insert_at_cursor('/' + \ message_buffer.insert_at_cursor('/' + \
self.cmd_hits[room_jid][0]) self.cmd_hits[room_jid][0] + ' ')
self.last_key_tabs[room_jid] = True self.last_key_tabs[room_jid] = True
return True return True
# nick completion # nick completion
splitted_text = text.split()
# check if tab is pressed with empty message # check if tab is pressed with empty message
if len(splitted_text): # if there are any words if len(splitted_text): # if there are any words
begin = splitted_text[-1] # last word we typed begin = splitted_text[-1] # last word we typed