summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-10 23:28:00 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-10 23:28:00 +0000
commit9ad62d4466cb1f1566be503d7a7ff8657e330673 (patch)
tree1e8882b91cb3e130cd6e2f664da289b6231f8da6
parentfc99b9e8625af9ec2916ed641de0dc3b093a7cea (diff)
downloadpoezio-9ad62d4466cb1f1566be503d7a7ff8657e330673.tar.gz
poezio-9ad62d4466cb1f1566be503d7a7ff8657e330673.tar.bz2
poezio-9ad62d4466cb1f1566be503d7a7ff8657e330673.tar.xz
poezio-9ad62d4466cb1f1566be503d7a7ff8657e330673.zip
Fix Link Mauve completion bug
-rw-r--r--src/connection.py1
-rw-r--r--src/poezio.py2
-rw-r--r--src/room.py8
-rw-r--r--src/window.py29
4 files changed, 22 insertions, 18 deletions
diff --git a/src/connection.py b/src/connection.py
index ffe42665..c0bd5575 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -140,6 +140,7 @@ class Connection(threading.Thread):
def handler_normal_presence(self, connection, presence):
"""
+ handles the non-MUC presences
"""
fro = presence.getFrom()
toj = presence.getAttr('to')
diff --git a/src/poezio.py b/src/poezio.py
index da306c22..a37e28b3 100644
--- a/src/poezio.py
+++ b/src/poezio.py
@@ -94,7 +94,7 @@ def main():
main function
"""
resource = config.get('resource', 'poezio')
- server = config.get('server', 'louiz.org')
+ server = config.get('server', 'anon.louiz.org:jeproteste.info')
connection = Connection(server, resource)
connection.start()
stdscr = initscr()
diff --git a/src/room.py b/src/room.py
index 28e29b76..63003229 100644
--- a/src/room.py
+++ b/src/room.py
@@ -69,7 +69,7 @@ class Room(object):
Set the tab color and returns the txt color
"""
color = None
- if not time and nickname.encode('utf-8') != self.own_nick and self.joined and nickname is not None: # do the highlight
+ if not time and nickname and nickname.encode('utf-8') != self.own_nick and self.joined: # do the highlight
try:
if self.own_nick in txt.encode('utf-8'):
self.set_color_state(common.ROOM_STATE_HL)
@@ -101,12 +101,12 @@ class Room(object):
if user:
user.set_last_talked(datetime.now())
color = None
- if not time and nickname is not None and\
+ if not time and nickname and\
nickname != self.own_nick and\
self.color_state != common.ROOM_STATE_CURRENT:
- if not self.jid:
+ if not self.jid and self.color_state != common.ROOM_STATE_HL:
self.set_color_state(common.ROOM_STATE_MESSAGE)
- else:
+ elif self.jid:
self.set_color_state(common.ROOM_STATE_PRIVATE)
if not nickname:
color = 8
diff --git a/src/window.py b/src/window.py
index fbdaa1de..dd047335 100644
--- a/src/window.py
+++ b/src/window.py
@@ -368,7 +368,8 @@ class Input(Win):
# the first char to display on the screen
self.histo_pos = 0
self.hit_list = [] # current possible completion (normal)
- self.last_key_tab = False # True if we are cycling through possible completion
+ self.last_completion = None # Contains the last nickname completed,
+ # if last key was a tab
def resize(self, height, width, y, x, stdscr, visible):
self.visible = visible
@@ -568,18 +569,20 @@ class Input(Win):
Reset the completion list (called on ALL keys except tab)
"""
self.hit_list = []
- self.last_key_tab = False
+ self.last_completion = None
def normal_completion(self, user_list):
"""
Normal completion
"""
- if " " in self.text.strip():
- after = " " # don't put the "," if it's not the begining of the sentence
- else:
+ if " " not in self.text.strip() or\
+ self.last_completion and self.text == self.last_completion+config.get('after_completion', ',')+" ":
after = config.get('after_completion', ',')+" "
+ #if " " in self.text.strip() and (not self.last_completion or ' ' in self.last_completion):
+ else:
+ after = " " # don't put the "," if it's not the begining of the sentence
(y, x) = self.win.getyx()
- if not self.last_key_tab:
+ if not self.last_completion:
# begin is the begining of the nick we want to complete
if self.text != '':
begin = self.text.split()[-1].encode('utf-8').lower()
@@ -591,15 +594,15 @@ class Input(Win):
hit_list.append(user)
if len(hit_list) == 0:
return
- self.last_key_tab = True
self.hit_list = hit_list
end = len(begin.decode('utf-8'))
else:
- begin = self.text[:-len(after)].split()[-1].encode('utf-8').lower()
+ begin = self.text[-len(after)-len(self.last_completion):-len(after)]
self.hit_list.append(self.hit_list.pop(0)) # rotate list
end = len(begin.decode('utf-8')) + len(after)
self.text = self.text[:-end]
nick = self.hit_list[0] # take the first hit
+ self.last_completion = nick.decode('utf-8')
self.text += nick.decode('utf-8') +after
self.key_end(False)
@@ -624,16 +627,16 @@ class Input(Win):
return
end = False
nick = ''
- last_key_tab = self.last_key_tab
- self.last_key_tab = True
+ last_completion = self.last_completion
+ self.last_completion = True
if len(hit_list) == 1:
nick = hit_list[0] + after
- self.last_key_tab = False
- elif last_key_tab:
+ self.last_completion = False
+ elif last_completion:
for n in hit_list:
if begin.lower() == n.lower():
nick = n+after # user DO want this completion (tabbed twice on it)
- self.last_key_tab = False
+ self.last_completion = False
if nick == '':
while not end and len(nick) < len(hit_list[0]):
nick = hit_list[0][:len(nick)+1]