mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-11-26 01:46:22 -05:00
channels: don't snap window to bottom of chat when a message arrives
This commit is contained in:
parent
7e904ede5f
commit
087261c8bb
1 changed files with 7 additions and 5 deletions
|
|
@ -492,17 +492,19 @@ class RoomWidget(urwid.WidgetWrap):
|
||||||
widget = _message_widget(self.app, self.hub, msg, link_delegate=self.link_delegate)
|
widget = _message_widget(self.app, self.hub, msg, link_delegate=self.link_delegate)
|
||||||
wrapped = urwid.AttrMap(widget, None)
|
wrapped = urwid.AttrMap(widget, None)
|
||||||
body = self.messagelist._listbox.body
|
body = self.messagelist._listbox.body
|
||||||
|
was_at_bottom = getattr(self, "_empty_placeholder", False) or getattr(self.messagelist, "bottom_is_visible", True)
|
||||||
if getattr(self, "_empty_placeholder", False):
|
if getattr(self, "_empty_placeholder", False):
|
||||||
del body[:]
|
del body[:]
|
||||||
self._empty_placeholder = False
|
self._empty_placeholder = False
|
||||||
body.append(wrapped)
|
body.append(wrapped)
|
||||||
while len(body) > self.MAX_RENDERED_MESSAGES:
|
while len(body) > self.MAX_RENDERED_MESSAGES:
|
||||||
del body[0]
|
del body[0]
|
||||||
try:
|
if was_at_bottom:
|
||||||
self.messagelist._listbox.set_focus(len(body)-1)
|
try:
|
||||||
self.messagelist._listbox.set_focus_valign("bottom")
|
self.messagelist._listbox.set_focus(len(body)-1)
|
||||||
except Exception:
|
self.messagelist._listbox.set_focus_valign("bottom")
|
||||||
pass
|
except Exception:
|
||||||
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Incremental append failed, falling back: "+str(e), RNS.LOG_DEBUG)
|
RNS.log("Incremental append failed, falling back: "+str(e), RNS.LOG_DEBUG)
|
||||||
self.update_messages(replace=True)
|
self.update_messages(replace=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue