Chat quick switcher MRU, Closed section and markers; Alt+N, Alt+J and run tab keys
Ctrl+K lists open chats most recently used first (tracked on open and pane focus, persisted per server) and preselects the previous chat, so Ctrl+K, Enter returns to it. Rows mark needs you / working / unread; a query also lists matching closed chats under Closed, and choosing one reopens it. Alt+N (Option+N) starts a new chat and Alt+J (Option+J) opens the next chat waiting for you, unread or failed, cycling; the terminal keeps both. In run detail, bare 1-4 switch tabs when not typing. Cheatsheet entries added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,8 @@ class _Switcher {
|
||||
Future<_Switcher> _open(
|
||||
WidgetTester tester, {
|
||||
Size size = const Size(900, 800),
|
||||
List<String> recent = const [],
|
||||
String? currentId,
|
||||
}) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
@@ -54,6 +56,8 @@ Future<_Switcher> _open(
|
||||
onPressed: () => switcher.route = showChatQuickSwitch(
|
||||
context,
|
||||
sessions: controller,
|
||||
recent: () => recent,
|
||||
currentId: currentId,
|
||||
onSelected: (row) => switcher.chosen.add('${row['id']}'),
|
||||
),
|
||||
child: const Text('Open'),
|
||||
@@ -162,8 +166,20 @@ void main() {
|
||||
'build',
|
||||
);
|
||||
await tester.pump();
|
||||
// The closed chat titled "Closed build" is not offered.
|
||||
expect(_shown(tester), ['one']);
|
||||
// The closed chat titled "Closed build" follows under Closed.
|
||||
expect(_shown(tester), ['one', 'gone']);
|
||||
expect(
|
||||
find.byKey(const Key('chat-quick-switch-closed-header')),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
tester.getTopLeft(find.text('Closed')).dy,
|
||||
lessThan(
|
||||
tester
|
||||
.getTopLeft(find.byKey(const Key('chat-quick-switch-row-gone')))
|
||||
.dy,
|
||||
),
|
||||
);
|
||||
await tester.enterText(
|
||||
find.byKey(const Key('chat-quick-switch-field')),
|
||||
'zzz',
|
||||
@@ -213,6 +229,38 @@ void main() {
|
||||
await tester.pump();
|
||||
});
|
||||
|
||||
testWidgets(
|
||||
'no query: most recent first, the previous chat selected; Enter goes back',
|
||||
(tester) async {
|
||||
final switcher = await _open(
|
||||
tester,
|
||||
recent: ['three', 'two'],
|
||||
currentId: 'three',
|
||||
);
|
||||
expect(_shown(tester), ['three', 'two', 'one']);
|
||||
expect(_selected(tester), 'two');
|
||||
await _key(tester, LogicalKeyboardKey.enter);
|
||||
await tester.pumpAndSettle();
|
||||
expect(switcher.chosen, ['two']);
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets('rows mark working, needs you and unread chats', (tester) async {
|
||||
await _open(tester);
|
||||
final two = find.byKey(const Key('chat-quick-switch-row-two'));
|
||||
expect(
|
||||
find.descendant(
|
||||
of: two,
|
||||
matching: find.byKey(const Key('chat-quick-switch-marker-working')),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const Key('chat-quick-switch-marker-needsYou')),
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('a phone shows it as a full-width bottom sheet', (tester) async {
|
||||
await _open(tester, size: const Size(400, 800));
|
||||
expect(find.byType(Dialog), findsNothing);
|
||||
|
||||
Reference in New Issue
Block a user