Open a diff as a floating window

Diffs join the app's window system: Open in a window on a diff page or a
chat diff card shows the same files, on the same file, in a draggable,
resizable window with the full diff viewer (keys, search, all-files
view). Offered only where floating windows show; a diff window's files
live in memory, so it is not restored after a reload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 20:06:45 +00:00
parent 71719b5707
commit dd742ec8e4
5 changed files with 271 additions and 5 deletions
+8 -1
View File
@@ -48,6 +48,7 @@ import '../shell/windows/window_manager.dart';
import '../shell/windows/window_store.dart';
import 'app_terminals.dart';
import '../features/chat/chat_runtime.dart';
import '../features/changes/windows/diff_windows.dart';
import '../features/chat/windows/chat_windows.dart';
import 'open_in_chat.dart';
import 'send_to_chat.dart';
@@ -311,6 +312,7 @@ class _PipelinesAppState extends State<PipelinesApp>
NotificationServiceHandoff? _deliveryHandoff;
late final AppTerminals _terminals;
late final WindowManager _windows;
late final DiffWindows _diffWindows;
late final ChatRuntime _chatRuntime;
late final ChatWindows _chatWindows;
@@ -368,6 +370,7 @@ class _PipelinesAppState extends State<PipelinesApp>
layout: widget.terminalLayout ?? TerminalLayout.instance,
windows: _windows,
);
_diffWindows = DiffWindows(_windows)..start();
// Every kind is registered: saved windows can be restored. Then the
// terminal may open its window, and the floating chats an older build
// saved are brought over once.
@@ -604,6 +607,7 @@ class _PipelinesAppState extends State<PipelinesApp>
_session.removeListener(_chatSyncChanged);
widget.chatPool?.removeListener(_chatSyncChanged);
_chatWindows.dispose();
_diffWindows.dispose();
_chatRuntime.dispose();
if (widget.windows == null) _windows.dispose();
_session.dispose();
@@ -931,7 +935,10 @@ class _PipelinesAppState extends State<PipelinesApp>
ValueListenableBuilder<_RunIndicators>(
valueListenable: _attentionCount,
builder: (context, count, _) => _terminals.surround(
_shellFor(route, count),
DiffWindowsScope(
windows: _diffWindows,
child: _shellFor(route, count),
),
// Every narrow Chat bar carries Terminal itself (the list's top bar
// and an open chat's bar, see terminalChatBarAction), so the floating
// bubble is off on every route. It otherwise covered the list's