changeset 2332:7df0a77a5064

primitivus (chat): only scroll down if we are at the bottom of the discussion
author Goffi <goffi@goffi.org>
date Fri, 14 Jul 2017 08:32:49 +0200
parents 01877048c94a
children a21b3b31086d
files frontends/src/primitivus/chat.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/primitivus/chat.py	Thu Jul 13 22:49:37 2017 +0200
+++ b/frontends/src/primitivus/chat.py	Fri Jul 14 08:32:49 2017 +0200
@@ -449,7 +449,10 @@
         else:
             wid = MessageWidget(message)
             self.mess_walker.append(wid)
-            self.mess_widgets.focus_position = len(self.mess_walker) - 1  # scroll down
+            current_focus = self.mess_widgets.focus_position
+            bottom = len(self.mess_walker) - 1
+            if current_focus == bottom - 1:
+                self.mess_widgets.focus_position = bottom  # scroll down
             self.host.redraw()  # FIXME: should not be necessary
             if self._user_moved(message):
                 return  # no notification for moved messages