Chat: Ctrl+Tab cycles the list's chats, starred only when any are starred
Ctrl+Tab / Ctrl+Shift+Tab on the Chat destination now steps through the chat list's open chats in list order (wrapping) instead of the workspace panes: only the starred chats when any open chat is starred, otherwise all open chats. From a chat outside the cycle it goes to the first (Shift: last). The target opens as a list click does, focusing the pane already showing it. The terminal's claim on Ctrl+Tab and floating-window cycling are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -63,4 +63,37 @@ void main() {
|
||||
expect(_after(const [], 'only'), isNull);
|
||||
expect(_after(one, 'elsewhere'), 'only');
|
||||
});
|
||||
|
||||
String? tab(List<JsonMap> cycle, String id, int step) =>
|
||||
chatTabTarget(cycle, id, step)?['id'] as String?;
|
||||
|
||||
test('tab cycle: starred only when any open chat is starred', () {
|
||||
final cycle = chatTabCycle(sessions);
|
||||
expect(_ids(cycle), ['a', 'z']);
|
||||
expect(tab(cycle, 'a', 1), 'z');
|
||||
expect(tab(cycle, 'z', 1), 'a');
|
||||
expect(tab(cycle, 'a', -1), 'z');
|
||||
// Outside the cycle: first forwards, last backwards.
|
||||
expect(tab(cycle, 'r', 1), 'a');
|
||||
expect(tab(cycle, 'r', -1), 'z');
|
||||
});
|
||||
|
||||
test('tab cycle: every open chat when none is starred', () {
|
||||
final unstarred = [
|
||||
for (final row in sessions) {...row}..remove('starred'),
|
||||
];
|
||||
final cycle = chatTabCycle(unstarred);
|
||||
expect(_ids(cycle), ['r', 's', 'z', 'd', 'a']);
|
||||
expect(tab(cycle, 'a', 1), 'r');
|
||||
expect(tab(cycle, 'r', -1), 'a');
|
||||
// A closed starred chat does not make a starred cycle.
|
||||
final closedStar = <JsonMap>[
|
||||
{'id': 'x', 'starred': true, 'closed_at': 1},
|
||||
{'id': 'y'},
|
||||
{'id': 'w', 'closed': true},
|
||||
];
|
||||
expect(_ids(chatTabCycle(closedStar)), ['y']);
|
||||
expect(tab(chatTabCycle(closedStar), 'y', 1), isNull);
|
||||
expect(tab(const [], 'y', 1), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user