comparison frontends/src/primitivus/chat.py @ 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 4f3ebf786fbc
children a21b3b31086d
comparison
equal deleted inserted replaced
2331:01877048c94a 2332:7df0a77a5064
447 if not message.message: 447 if not message.message:
448 log.error(u"Received an empty message for uid {}".format(message.uid)) 448 log.error(u"Received an empty message for uid {}".format(message.uid))
449 else: 449 else:
450 wid = MessageWidget(message) 450 wid = MessageWidget(message)
451 self.mess_walker.append(wid) 451 self.mess_walker.append(wid)
452 self.mess_widgets.focus_position = len(self.mess_walker) - 1 # scroll down 452 current_focus = self.mess_widgets.focus_position
453 bottom = len(self.mess_walker) - 1
454 if current_focus == bottom - 1:
455 self.mess_widgets.focus_position = bottom # scroll down
453 self.host.redraw() # FIXME: should not be necessary 456 self.host.redraw() # FIXME: should not be necessary
454 if self._user_moved(message): 457 if self._user_moved(message):
455 return # no notification for moved messages 458 return # no notification for moved messages
456 459
457 # notifications 460 # notifications