fix(ui): keep ConPTY sessions alive across Mission Control layout rebuilds

TerminalView kills its child process on any logical-tree detach unless
BeginReparent() suppressed it, and RebuildOverviewGrid() detaches every
existing pane whenever one is added - so opening a second interactive
session killed the first. Focus-mode tab switches had the same defect.

PtyTerminalSession now puts the control in permanent reparent mode after
launch (teardown stays explicit via ConPtyPaneViewModel.Dispose -> Kill),
and the new ConPtyPaneHost reparents each pane's single long-lived view
across grid rebuilds and tab switches instead of letting the DataTemplate
instantiate a dead replacement.
This commit is contained in:
mika kuns
2026-08-06 12:43:55 +02:00
parent 0878bae19e
commit aac84e48b7
4 changed files with 73 additions and 1 deletions
@@ -46,6 +46,13 @@ public sealed class PtyTerminalSession : IDisposable
control.StartingDirectory = descriptor.Cwd;
await control.LaunchProcess();
// Permanent reparent mode: TerminalView.OnDetachedFromLogicalTree kills the child
// process unless BeginReparent() suppressed it, and Mission Control detaches pane
// views routinely (overview-grid rebuilds on pane add/remove, focus-mode tab
// switches). ClaudeDo owns teardown explicitly instead — ConPtyPaneViewModel.Dispose
// calls Kill() when a pane closes — so EndReparent is deliberately never called.
control.BeginReparent();
IsRunning = true;
}