Leave unrelated chat files as main formats them

This commit is contained in:
2026-11-10 15:26:54 +00:00
parent cdd54c113c
commit e059e58caf
8 changed files with 59 additions and 63 deletions
@@ -202,7 +202,7 @@ class _ChatBackgroundTasksState extends State<ChatBackgroundTasks> {
// Level with the field's single line, beside Send. // Level with the field's single line, beside Send.
padding: const EdgeInsetsDirectional.only(end: 4, bottom: 4), padding: const EdgeInsetsDirectional.only(end: 4, bottom: 4),
child: Semantics( child: Semantics(
identifier: 'chat-background-tasks-button', identifier: 'chat-background-tasks-button',
button: true, button: true,
excludeSemantics: true, excludeSemantics: true,
onTap: _open, onTap: _open,
@@ -142,10 +142,8 @@ class ChatWorkspaceGeometry {
}; };
if (gap < -slack || gap > chatPaneDividerExtent + slack) continue; if (gap < -slack || gap > chatPaneDividerExtent + slack) continue;
final overlap = horizontal final overlap = horizontal
? math.min(origin.bottom, rect.bottom) - ? math.min(origin.bottom, rect.bottom) - math.max(origin.top, rect.top)
math.max(origin.top, rect.top) : math.min(origin.right, rect.right) - math.max(origin.left, rect.left);
: math.min(origin.right, rect.right) -
math.max(origin.left, rect.left);
if (overlap <= slack) continue; if (overlap <= slack) continue;
final centred = horizontal final centred = horizontal
? rect.top <= centre && centre < rect.bottom ? rect.top <= centre && centre < rect.bottom
@@ -82,10 +82,7 @@ Future<void> _openMenu(WidgetTester tester, String session) async {
MenuItemButton _item(WidgetTester tester, String label) => MenuItemButton _item(WidgetTester tester, String label) =>
tester.widget<MenuItemButton>( tester.widget<MenuItemButton>(
find.ancestor( find.ancestor(of: find.text(label), matching: find.byType(MenuItemButton)),
of: find.text(label),
matching: find.byType(MenuItemButton),
),
); );
ChatWorkspaceController _controller(WidgetTester tester) => ChatWorkspaceController _controller(WidgetTester tester) =>
@@ -208,9 +205,7 @@ void main() {
final gateway = _Gateway()..history = (_) async => chatPage([]); final gateway = _Gateway()..history = (_) async => chatPage([]);
addTearDown(gateway.close); addTearDown(gateway.close);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(home: Scaffold(body: ChatScreen(gateway: gateway))),
home: Scaffold(body: ChatScreen(gateway: gateway)),
),
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.text('Chat a').first); await tester.tap(find.text('Chat a').first);
@@ -244,6 +244,9 @@ void main() {
isSameColorAs(tint.foreground), isSameColorAs(tint.foreground),
); );
// Outside the bar the theme's tint is untouched. // Outside the bar the theme's tint is untouched.
expect(CupertinoTheme.of(context).primaryColor, isNot(tint.foreground)); expect(
CupertinoTheme.of(context).primaryColor,
isNot(tint.foreground),
);
}); });
} }
@@ -271,20 +271,19 @@ void main() {
expect(mounted.gateway.listings, 2); expect(mounted.gateway.listings, 2);
}); });
testWidgets( testWidgets('A refused move is shown in the server\'s words until dismissed', (
'A refused move is shown in the server\'s words until dismissed', tester,
(tester) async { ) async {
final mounted = await pump(tester); final mounted = await pump(tester);
const refusal = '$shown/docs/notes.txt already exists'; const refusal = '$shown/docs/notes.txt already exists';
mounted.gateway.refusals['move_path'] = refusal; mounted.gateway.refusals['move_path'] = refusal;
await dragOnto(tester, 'notes.txt', 'docs'); await dragOnto(tester, 'notes.txt', 'docs');
expect(find.text(refusal), findsOneWidget); expect(find.text(refusal), findsOneWidget);
expect(mounted.gateway.listings, 2, reason: 'reloaded all the same'); expect(mounted.gateway.listings, 2, reason: 'reloaded all the same');
await tester.tap(find.text('Dismiss')); await tester.tap(find.text('Dismiss'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text(refusal), findsNothing); expect(find.text(refusal), findsNothing);
}, });
);
test('canDropEntryOn refuses files, itself and its own subtree', () { test('canDropEntryOn refuses files, itself and its own subtree', () {
const docs = DirectoryEntry( const docs = DirectoryEntry(
@@ -39,10 +39,11 @@ void main() {
}); });
test('only visible assistant reply text is unread', () { test('only visible assistant reply text is unread', () {
bool attention(Map<String, Object?> event) => chatSessionFrameEffect({ bool attention(Map<String, Object?> event) =>
'type': 'chat_event', chatSessionFrameEffect({
'chat_event': {'session_id': 's', ...event}, 'type': 'chat_event',
})!.attention; 'chat_event': {'session_id': 's', ...event},
})!.attention;
for (final status in ['running', 'completed', 'error']) { for (final status in ['running', 'completed', 'error']) {
expect( expect(
attention({ attention({
@@ -66,7 +67,11 @@ void main() {
expect(attention({'kind': 'text', 'delta': ' \n'}), isFalse); expect(attention({'kind': 'text', 'delta': ' \n'}), isFalse);
for (final messageKind in ['notice', 'agent_report']) { for (final messageKind in ['notice', 'agent_report']) {
expect( expect(
attention({'kind': 'text', 'delta': 'x', 'message_kind': messageKind}), attention({
'kind': 'text',
'delta': 'x',
'message_kind': messageKind,
}),
isFalse, isFalse,
); );
} }
@@ -76,36 +76,34 @@ void main() {
expect(_opacity(tester), 1); expect(_opacity(tester), 1);
}); });
testWidgets( testWidgets('desktop shows it on hover and focus, and keeps semantics', (
'desktop shows it on hover and focus, and keeps semantics', tester,
(tester) async { ) async {
final semantics = tester.ensureSemantics(); final semantics = tester.ensureSemantics();
await tester.pumpWidget(_host(48)); await tester.pumpWidget(_host(48));
expect(_opacity(tester), 0); expect(_opacity(tester), 0);
// Hidden, it is still reachable by a screen reader. // Hidden, it is still reachable by a screen reader.
expect( expect(
tester.getSemantics(_copy), tester.getSemantics(_copy),
isSemantics(tooltip: 'Copy', isButton: true, isFocusable: true), isSemantics(tooltip: 'Copy', isButton: true, isFocusable: true),
); );
final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse); final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
addTearDown(mouse.removePointer); addTearDown(mouse.removePointer);
await mouse.addPointer(location: Offset.zero); await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(tester.getCenter(find.text('The answer text'))); await mouse.moveTo(tester.getCenter(find.text('The answer text')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_opacity(tester), 1); expect(_opacity(tester), 1);
await mouse.moveTo(const Offset(5, 590)); await mouse.moveTo(const Offset(5, 590));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_opacity(tester), 0); expect(_opacity(tester), 0);
// Keyboard focus reveals it too. // Keyboard focus reveals it too.
await tester.sendKeyEvent(LogicalKeyboardKey.tab); await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(_opacity(tester), 1); expect(_opacity(tester), 1);
semantics.dispose(); semantics.dispose();
}, }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
);
for (final (width, inGutter) in [(1400.0, true), (560.0, false)]) { for (final (width, inGutter) in [(1400.0, true), (560.0, false)]) {
testWidgets('a ${width.toInt()} px conversation puts Copy ' testWidgets('a ${width.toInt()} px conversation puts Copy '
@@ -125,9 +125,7 @@ void main() {
addTearDown(controller.dispose); addTearDown(controller.dispose);
final outer = controller.root as ChatWorkspaceSplit; final outer = controller.root as ChatWorkspaceSplit;
controller.resize(outer.id, .3); controller.resize(outer.id, .3);
final ids = { final ids = {for (final s in ['a', 'b', 'c', 'd']) s: _id(controller, s)};
for (final s in ['a', 'b', 'c', 'd']) s: _id(controller, s),
};
final serial = controller.moveSerial; final serial = controller.moveSerial;
controller.swap(ids['a']!, ids['c']!); controller.swap(ids['a']!, ids['c']!);
expect(controller.panes.map((p) => p.sessionId), ['c', 'b', 'a', 'd']); expect(controller.panes.map((p) => p.sessionId), ['c', 'b', 'a', 'd']);