primitivus: chat window is not scrolled anymore when user is watching history and a new message is received

This commit is contained in:
Goffi 2011-11-11 19:50:24 +01:00
commit 2fdaeb1cac

View file

@ -229,7 +229,10 @@ class Chat(urwid.WidgetWrap, QuickChat):
return
my_jid = self.host.profiles[profile]['whoami']
self.content.append(ChatText(self, timestamp or None, nick, mymess, msg))
self.text_list.set_focus(len(self.content)-1)
if self.text_list.get_focus()[1] == len(self.content)-2:
#we don't change focus if user is not at the bottom
#as that mean that he is probably watching discussion history
self.text_list.set_focus(len(self.content)-1)
self.host.redraw()
if not self.host.notify.hasFocus():
if self.type=="one2one":
@ -245,7 +248,10 @@ class Chat(urwid.WidgetWrap, QuickChat):
me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
"""
self.content.append(sat_widgets.ClickableText(msg))
self.text_list.set_focus(len(self.content)-1)
if self.text_list.get_focus()[1] == len(self.content)-2:
#we don't change focus if user is not at the bottom
#as that mean that he is probably watching discussion history
self.text_list.set_focus(len(self.content)-1)
self.host.redraw()
if not self.host.notify.hasFocus():
if self.type=="one2one":