1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! Session state types for save/restore on startup.
//!
//! This module provides **automatic session persistence**: save the current window
//! layout, tabs, and pane splits on clean exit, then restore them on next launch.
//!
//! # Relationship to `crate::arrangements`
//!
//! par-term has two overlapping session persistence mechanisms:
//!
//! | Feature | Module | Trigger | Scope |
//! |---------|--------|---------|-------|
//! | Auto session restore | `crate::session` (this module) | Automatic on clean exit / next launch | Last-session state only (single slot) |
//! | Named arrangements | `crate::arrangements` | User-initiated save/restore via UI | Multiple named snapshots, monitor-aware |
//!
//! Both capture window positions, sizes, tab CWDs, and tab titles using similar
//! serialization patterns (serde JSON via `storage` submodule). The key distinction
//! is lifecycle: session state is ephemeral (overwritten on each clean exit), while
//! arrangements are user-named and persist indefinitely.
//!
//! # Shared types
//!
//! The common per-tab fields (`cwd`, `title`, `custom_color`, `user_title`,
//! `custom_icon`) are defined once in [`par_term_config::snapshot_types::TabSnapshot`]
//! and are embedded into [`SessionTab`] via `#[serde(flatten)]`. The arrangements
//! module re-exports the same type directly, eliminating the previous duplication.
//! Existing YAML session files are fully backward-compatible — all fields remain at
//! the same nesting level.
// Re-export TabSnapshot so session consumers can use `crate::session::TabSnapshot`.
use crateSplitDirection;
pub use TabSnapshot;
use ;
/// Top-level session state: all windows at the time of save
/// A single window in the saved session
/// A single tab in a saved session.
///
/// The common tab fields (`cwd`, `title`, `custom_color`, `user_title`,
/// `custom_icon`) are inherited from [`TabSnapshot`] via `#[serde(flatten)]`
/// so that the serialized YAML layout is unchanged from before this refactor.
/// The session-specific field `pane_layout` is appended alongside the flattened
/// fields in the output.
/// Recursive pane tree node for session persistence