mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-10-26 19:01:44 -04:00
rrc: truncate in-memory messages to rrc.history_per_room_cap instead of 500
This commit is contained in:
parent
087261c8bb
commit
93b5496fc4
1 changed files with 4 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue