fix a tb in TAB. thanks deluge

This commit is contained in:
Nikos Kouremenos 2005-09-07 17:08:32 +00:00
parent d5c5428b16
commit 0fb750e9c2
1 changed files with 29 additions and 27 deletions

View File

@ -520,35 +520,37 @@ class GroupchatWindow(chat.Chat):
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
if len(self.nick_hits[room_jid]) and \ if len(self.nick_hits[room_jid]) and \
self.nick_hits[room_jid][0].startswith(begin.replace( self.nick_hits[room_jid][0].startswith(begin.replace(
self.gc_refer_to_nick_char, '')) and \ self.gc_refer_to_nick_char, '')) and \
self.last_key_tabs[room_jid]: # we should cycle self.last_key_tabs[room_jid]: # we should cycle
self.nick_hits[room_jid].append(self.nick_hits[room_jid][0]) self.nick_hits[room_jid].append(self.nick_hits[room_jid][0])
self.nick_hits[room_jid].pop(0) self.nick_hits[room_jid].pop(0)
else:
self.nick_hits[room_jid] = [] # clear the hit list
list_nick = self.get_nick_list(room_jid)
for nick in list_nick:
if nick.lower().startswith(begin.lower()): # the word is the begining of a nick
self.nick_hits[room_jid].append(nick)
if len(self.nick_hits[room_jid]):
if len(splitted_text) == 1: # This is the 1st word of the line
add = self.gc_refer_to_nick_char + ' '
else: else:
add = ' ' self.nick_hits[room_jid] = [] # clear the hit list
start_iter = end_iter.copy() list_nick = self.get_nick_list(room_jid)
if self.last_key_tabs[room_jid] and begin.endswith(', '): for nick in list_nick:
start_iter.backward_chars(len(begin) + 2) # have to accomodate for the added space from last completion if nick.lower().startswith(begin.lower()): # the word is the begining of a nick
elif self.last_key_tabs[room_jid]: self.nick_hits[room_jid].append(nick)
start_iter.backward_chars(len(begin) + 1) # have to accomodate for the added space from last completion if len(self.nick_hits[room_jid]):
else: if len(splitted_text) == 1: # This is the 1st word of the line
start_iter.backward_chars(len(begin)) add = self.gc_refer_to_nick_char + ' '
else:
add = ' '
start_iter = end_iter.copy()
if self.last_key_tabs[room_jid] and begin.endswith(', '):
# have to accomodate for the added space from last completion
start_iter.backward_chars(len(begin) + 2)
elif self.last_key_tabs[room_jid]:
# have to accomodate for the added space from last completion
start_iter.backward_chars(len(begin) + 1)
else:
start_iter.backward_chars(len(begin))
message_buffer.delete(start_iter, end_iter) message_buffer.delete(start_iter, end_iter)
message_buffer.insert_at_cursor(self.nick_hits[room_jid][0] + add) message_buffer.insert_at_cursor(self.nick_hits[room_jid][0] + add)
self.last_key_tabs[room_jid] = True self.last_key_tabs[room_jid] = True
return True return True
self.last_key_tabs[room_jid] = False self.last_key_tabs[room_jid] = False
return False return False
elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN elif event.keyval == gtk.keysyms.Page_Down: # PAGE DOWN