# HG changeset patch
# User Goffi <goffi@goffi.org>
# Date 1321037424 -3600
# Node ID 7c7ec2347b56dcd224f587cfda027d80222137d5
# Parent  37285f2d37c8c07d6cccc43984a8ae41da9433fe
primitivus: chat window is not scrolled anymore when user is watching history and a new message is received

diff -r 37285f2d37c8 -r 7c7ec2347b56 frontends/src/primitivus/chat.py
--- a/frontends/src/primitivus/chat.py	Fri Nov 11 19:49:21 2011 +0100
+++ b/frontends/src/primitivus/chat.py	Fri Nov 11 19:50:24 2011 +0100
@@ -229,7 +229,10 @@
             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 @@
             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":