From 93b5496fc4bd9238942987033ed161a3aff896a2 Mon Sep 17 00:00:00 2001 From: Jeremy O'Brien Date: Sun, 17 May 2026 17:35:24 -0400 Subject: [PATCH] rrc: truncate in-memory messages to rrc.history_per_room_cap instead of 500 --- nomadnet/ui/textui/Channels.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nomadnet/ui/textui/Channels.py b/nomadnet/ui/textui/Channels.py index cd75aa9..b763182 100644 --- a/nomadnet/ui/textui/Channels.py +++ b/nomadnet/ui/textui/Channels.py @@ -459,8 +459,6 @@ class RoomWidget(urwid.WidgetWrap): right = status_label+" " self.peer_info_widget.original_widget.set_text(left+" | "+right) - MAX_RENDERED_MESSAGES = 500 - def update_messages(self, replace=False): msgs = self.hub.get_messages(self.room) if (self.hub is not None and self.room is not None) else [] widgets = [] @@ -497,8 +495,10 @@ class RoomWidget(urwid.WidgetWrap): del body[:] self._empty_placeholder = False body.append(wrapped) - while len(body) > self.MAX_RENDERED_MESSAGES: - del body[0] + cap = getattr(self.app, "rrc_history_per_room_cap", 0) + if cap and cap > 0: + while len(body) > cap: + del body[0] if was_at_bottom: try: self.messagelist._listbox.set_focus(len(body)-1)