From 087261c8bb836dc5bb9b48ef25be7cc542fa6f4e Mon Sep 17 00:00:00 2001 From: Jeremy O'Brien Date: Fri, 15 May 2026 20:40:48 -0400 Subject: [PATCH] channels: don't snap window to bottom of chat when a message arrives --- nomadnet/ui/textui/Channels.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nomadnet/ui/textui/Channels.py b/nomadnet/ui/textui/Channels.py index a96bd0f..cd75aa9 100644 --- a/nomadnet/ui/textui/Channels.py +++ b/nomadnet/ui/textui/Channels.py @@ -492,17 +492,19 @@ class RoomWidget(urwid.WidgetWrap): widget = _message_widget(self.app, self.hub, msg, link_delegate=self.link_delegate) wrapped = urwid.AttrMap(widget, None) 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): del body[:] self._empty_placeholder = False body.append(wrapped) while len(body) > self.MAX_RENDERED_MESSAGES: del body[0] - try: - self.messagelist._listbox.set_focus(len(body)-1) - self.messagelist._listbox.set_focus_valign("bottom") - except Exception: - pass + if was_at_bottom: + try: + self.messagelist._listbox.set_focus(len(body)-1) + self.messagelist._listbox.set_focus_valign("bottom") + except Exception: + pass except Exception as e: RNS.log("Incremental append failed, falling back: "+str(e), RNS.LOG_DEBUG) self.update_messages(replace=True)