pub(crate) async fn keep_workspace(
state: &AppState,
ws_id: String,
window: Value,
unlisted: bool,
left_for_switch: Option<&str>,
)Expand description
A window onto ws_id closed, and no other window shows it (window: where
it was). Stop what runs in it and keep its contents, listed as a closed
window unless unlisted, or a quit is closing every window: then the
window stays open in its workspace’s record and opens again with it. A
listed window’s agents are not stopped but parked (agents:always_available),
and its record names them, so a reopen puts them back.
unlisted is the close that ends the session (it emptied
Client.windowids) and a workspace switch’s closes. Contents with nothing
of the user’s in them are deleted instead.
left_for_switch is the user workspace a switch is leaving: that close is unlisted, but its agents
are parked like a listed window’s (closing parks, Stop is the only stop), and the saved record of
that workspace names them so switching back reattaches them (mark_parked_in_record). The close
that ends the session still stops its agents.