Fix web transcript cross-message selection
This commit is contained in:
@@ -19,6 +19,7 @@ import '../ui/sessions/chat_color_picker.dart';
|
||||
import '../ui/sessions/session_actions.dart';
|
||||
import '../ui/transcript/chat_markdown_view.dart';
|
||||
import '../ui/transcript/chat_message_view.dart';
|
||||
import '../ui/transcript/chat_transcript_selection.dart';
|
||||
import '../ui/transcript/chat_injected_rows.dart';
|
||||
import '../ui/transcript/chat_task_notices_group.dart';
|
||||
import '../../artifacts/actions/artifact_file_bridge.dart';
|
||||
@@ -999,117 +1000,119 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
// the viewport itself ends above the composer.
|
||||
// Bottom-anchored at the split row, the newest rows are
|
||||
// laid out first and older ones only when scrolled to.
|
||||
ChatTranscriptScrollView(
|
||||
key: ValueKey<String>(
|
||||
'chat-thread-${widget.sessionId}',
|
||||
ChatTranscriptSelectionArea(
|
||||
child: ChatTranscriptScrollView(
|
||||
key: ValueKey<String>(
|
||||
'chat-thread-${widget.sessionId}',
|
||||
),
|
||||
controller: _scroll,
|
||||
splitAfter: split < 0
|
||||
? null
|
||||
: ValueKey<String>(keys[split]),
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
side,
|
||||
media.top + 8,
|
||||
side,
|
||||
8,
|
||||
),
|
||||
children: [
|
||||
if (initialLoad)
|
||||
Padding(
|
||||
key: const Key('chat-thread-loading'),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: cupertino
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
if (_controller.hasMore)
|
||||
Padding(
|
||||
key: const Key('chat-load-older'),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: cupertino
|
||||
? CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: _controller.loading
|
||||
? null
|
||||
: _controller.loadOlder,
|
||||
child: const Text('Load older'),
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: _controller.loading
|
||||
? null
|
||||
: _controller.loadOlder,
|
||||
child: const Text('Load older'),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (historyNotice != null)
|
||||
_ChatNoticeLine(
|
||||
key: const Key('chat-history-error'),
|
||||
notice: historyNotice,
|
||||
onDismiss: _dismiss,
|
||||
onRetry: _controller.load,
|
||||
),
|
||||
if (liveNotice != null)
|
||||
_ChatNoticeLine(
|
||||
key: const Key('chat-live-error'),
|
||||
notice: liveNotice,
|
||||
onDismiss: _dismiss,
|
||||
onRetry: _controller.resync,
|
||||
),
|
||||
if (_controller.loaded &&
|
||||
allRows.isEmpty &&
|
||||
allNotices.isEmpty &&
|
||||
_commandNotices.isEmpty &&
|
||||
_controller.error == null)
|
||||
const Padding(
|
||||
key: Key('chat-thread-empty'),
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text('No messages in this chat yet.'),
|
||||
),
|
||||
...transcript,
|
||||
// Messages the server holds queued (one sent before
|
||||
// a reload, or from another device) follow the
|
||||
// transcript: none has reached the harness yet.
|
||||
for (final prompt
|
||||
in _controller.queuedOutsideTranscript)
|
||||
Padding(
|
||||
key: ValueKey<String>(
|
||||
'chat-queued-${prompt['operation_id']}',
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: _queuedRow(prompt, cupertino),
|
||||
),
|
||||
// Messages the server has not accepted follow the
|
||||
// transcript until they are retried or edited.
|
||||
for (final send in _composer.deliveries.unsent)
|
||||
Padding(
|
||||
key: ValueKey<String>(
|
||||
'chat-unsent-${send.operationId}',
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: _unsentRow(send, cupertino),
|
||||
),
|
||||
// The conversation's own command lines sit after the
|
||||
// turns, as on the web; they are never bubbles.
|
||||
for (final notice in _commandNotices)
|
||||
_ChatNoticeLine(
|
||||
key: ValueKey<String>(
|
||||
'chat-command-notice-${notice.condition}',
|
||||
),
|
||||
notice: notice,
|
||||
onDismiss: _dismiss,
|
||||
),
|
||||
],
|
||||
),
|
||||
controller: _scroll,
|
||||
splitAfter: split < 0
|
||||
? null
|
||||
: ValueKey<String>(keys[split]),
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
side,
|
||||
media.top + 8,
|
||||
side,
|
||||
8,
|
||||
),
|
||||
children: [
|
||||
if (initialLoad)
|
||||
Padding(
|
||||
key: const Key('chat-thread-loading'),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: cupertino
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
),
|
||||
),
|
||||
if (_controller.hasMore)
|
||||
Padding(
|
||||
key: const Key('chat-load-older'),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: cupertino
|
||||
? CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: _controller.loading
|
||||
? null
|
||||
: _controller.loadOlder,
|
||||
child: const Text('Load older'),
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: _controller.loading
|
||||
? null
|
||||
: _controller.loadOlder,
|
||||
child: const Text('Load older'),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (historyNotice != null)
|
||||
_ChatNoticeLine(
|
||||
key: const Key('chat-history-error'),
|
||||
notice: historyNotice,
|
||||
onDismiss: _dismiss,
|
||||
onRetry: _controller.load,
|
||||
),
|
||||
if (liveNotice != null)
|
||||
_ChatNoticeLine(
|
||||
key: const Key('chat-live-error'),
|
||||
notice: liveNotice,
|
||||
onDismiss: _dismiss,
|
||||
onRetry: _controller.resync,
|
||||
),
|
||||
if (_controller.loaded &&
|
||||
allRows.isEmpty &&
|
||||
allNotices.isEmpty &&
|
||||
_commandNotices.isEmpty &&
|
||||
_controller.error == null)
|
||||
const Padding(
|
||||
key: Key('chat-thread-empty'),
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text('No messages in this chat yet.'),
|
||||
),
|
||||
...transcript,
|
||||
// Messages the server holds queued (one sent before
|
||||
// a reload, or from another device) follow the
|
||||
// transcript: none has reached the harness yet.
|
||||
for (final prompt
|
||||
in _controller.queuedOutsideTranscript)
|
||||
Padding(
|
||||
key: ValueKey<String>(
|
||||
'chat-queued-${prompt['operation_id']}',
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: _queuedRow(prompt, cupertino),
|
||||
),
|
||||
// Messages the server has not accepted follow the
|
||||
// transcript until they are retried or edited.
|
||||
for (final send in _composer.deliveries.unsent)
|
||||
Padding(
|
||||
key: ValueKey<String>(
|
||||
'chat-unsent-${send.operationId}',
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
),
|
||||
child: _unsentRow(send, cupertino),
|
||||
),
|
||||
// The conversation's own command lines sit after the
|
||||
// turns, as on the web; they are never bubbles.
|
||||
for (final notice in _commandNotices)
|
||||
_ChatNoticeLine(
|
||||
key: ValueKey<String>(
|
||||
'chat-command-notice-${notice.condition}',
|
||||
),
|
||||
notice: notice,
|
||||
onDismiss: _dismiss,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (showJump)
|
||||
PositionedDirectional(
|
||||
|
||||
Reference in New Issue
Block a user