viewerBacklogSlice function
Caps the pre-open backlog to the last _viewerBacklogCap rows and
returns an optional caption naming the hidden remainder. Live rows
pass through untouched.
Implementation
(List<AttachedMessage>, String?) viewerBacklogSlice(
List<AttachedMessage> rows,
bool sawBacklog,
) {
if (sawBacklog) return (rows, null);
if (rows.length <= _viewerBacklogCap) return (rows, null);
return (
rows.sublist(rows.length - _viewerBacklogCap),
'… ${rows.length - _viewerBacklogCap} earlier rows not shown '
'— the full transcript lives in the session',
);
}