Chat: choosing a docked chat hides the floating chat windows
A chat opened from the list, Ctrl+Tab or the quick switcher opened behind the floating windows. Choosing a docked chat now hides the window group (Alt+Y-style chord brings it back); choosing a floating chat shows its window as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -256,6 +256,10 @@ class _ChatScreenState extends State<ChatScreen>
|
||||
_openedSessions[id] = session;
|
||||
_workspaceVisible = true;
|
||||
_workspace.open(id);
|
||||
// A docked chat chosen while chat windows float over the workspace would
|
||||
// open behind them: hide the windows so the chosen chat is seen.
|
||||
final windows = widget.windows;
|
||||
if (windows != null && !windows.holds(id)) windows.hideAll();
|
||||
if (_runtime.startNotice?.id != id) _runtime.startNotice = null;
|
||||
final select = widget.onSessionSelected;
|
||||
if (select != null) {
|
||||
|
||||
@@ -132,6 +132,13 @@ class ChatWindows {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Whether [sessionId] is in a chat window.
|
||||
bool holds(String sessionId) =>
|
||||
manager.find(chatWindowKind, sessionId) != null;
|
||||
|
||||
/// Hides every chat window (the group stays, to be shown again later).
|
||||
void hideAll() => manager.setGroupShown(chatWindowKind, false);
|
||||
|
||||
/// Opens [sessionId] in a window (the caller took it out of the tiling).
|
||||
void float(String sessionId) => manager.open(chatWindowKind, sessionId);
|
||||
|
||||
|
||||
@@ -425,6 +425,35 @@ void main() {
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('choosing a docked chat hides the floating windows; choosing '
|
||||
'a floating one shows it', (tester) async {
|
||||
await _saved('a', 'b', 'c');
|
||||
final app = _App(_Store());
|
||||
await app.start(tester);
|
||||
await _menu(tester, 'c', 'Float (Alt+Y)');
|
||||
expect(app.floating, ['c']);
|
||||
expect(_shown('Chat c'), findsOneWidget);
|
||||
|
||||
// Ctrl+Tab to the other docked chat hides the window over the tiling.
|
||||
await tester.tapAt(tester.getCenter(_input('a')));
|
||||
await tester.pump();
|
||||
await _tab(tester);
|
||||
expect(_workspace(tester).activePane?.sessionId, 'b');
|
||||
expect(_shown('Chat c'), findsNothing);
|
||||
expect(app.floating, ['c']);
|
||||
|
||||
// Choosing the floating chat from the list brings its window back.
|
||||
await tester.tap(find.byTooltip('Chat actions for Chat c').first);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Chat c').first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(_shown('Chat c'), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
await app.stop(tester);
|
||||
});
|
||||
|
||||
testWidgets('X minimises the window: the chat stays open, returns nothing '
|
||||
'to the tiling, and the chord brings the window back', (tester) async {
|
||||
await _saved('a', 'b');
|
||||
@@ -617,8 +646,8 @@ void main() {
|
||||
expect(_composerFocused(tester, 'a'), isTrue);
|
||||
expect(app.floating, ['c']);
|
||||
|
||||
// No window shown: the panes cycle and the hidden window stays hidden.
|
||||
await _chord(tester);
|
||||
// Choosing a docked chat hid the window; the panes keep cycling and the
|
||||
// hidden window stays hidden.
|
||||
expect(_shown('Chat c'), findsNothing);
|
||||
await tester.tapAt(tester.getCenter(_input('a')));
|
||||
await tester.pump();
|
||||
|
||||
Reference in New Issue
Block a user