Group each transcript row's text into one selectable

The transcript's scroll view kept every text run of every mounted row as
its own selectable and merged newly mounted runs into that list by
comparing global transforms, which dominated slow scroll frames at 4K.
Each row now wraps its content in a SelectionContainer, so the scroll
view orders rows and each row orders only its own runs once on mount.
Cross-row selection and copy order are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 18:21:28 +00:00
parent 58c72538d5
commit fa92b9a1a0
3 changed files with 83 additions and 17 deletions
@@ -1261,24 +1261,26 @@ class _ChatThreadViewState extends State<ChatThreadView> {
// Slivers mount only visible rows. Defer constructing
// their chips and checking cached widgets until then,
// rather than visiting the entire history per delta.
child: ChatCopyGutter(
width: rows[index]['kind'] == 'assistant'
? gutter
: 0,
child: Builder(
builder: (_) => _entering(
rows[index],
_transcriptRow(
child: ChatTranscriptRowSelection(
child: ChatCopyGutter(
width: rows[index]['kind'] == 'assistant'
? gutter
: 0,
child: Builder(
builder: (_) => _entering(
rows[index],
keys[index],
onDismissCompaction:
compactionNotice != null &&
chatNoticeActivityCondition(
rows[index],
) ==
compactionNotice.condition
? () => _dismiss(compactionNotice)
: null,
_transcriptRow(
rows[index],
keys[index],
onDismissCompaction:
compactionNotice != null &&
chatNoticeActivityCondition(
rows[index],
) ==
compactionNotice.condition
? () => _dismiss(compactionNotice)
: null,
),
),
),
),