From 2fdaeb1cac157574243517e53891c3b71cde2462 Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 11 Nov 2011 19:50:24 +0100 Subject: [PATCH] primitivus: chat window is not scrolled anymore when user is watching history and a new message is received --- frontends/src/primitivus/chat.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontends/src/primitivus/chat.py b/frontends/src/primitivus/chat.py index fb794a9e..7ffaeb50 100644 --- a/frontends/src/primitivus/chat.py +++ b/frontends/src/primitivus/chat.py @@ -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":