Skip to content

Commit b01637c

Browse files
committed
feat(session): persist and restore pane scrollback
Continue-where-you-left-off now brings the previous session's scrollback back, not just the empty pane skeleton. Each pane writes its most recent 1500 lines to a bincode sidecar under ~/.config/kaku/session_content/<dir>/pane_<id>.bin; on restore the lines reflow via Line::wrap when the column width changed and get prepended into the freshly spawned shell's primary scrollback so the user's new prompt stays at the bottom. SNAPSHOT_VERSION bumps 3->4. A separate CONTENT_SCHEMA_VERSION lives inside each sidecar plus a WEZTERM_SURFACE_FINGERPRINT constant lets the cell payload evolve independently of the JSON envelope. All content failures (missing sidecar, corrupt bincode, schema mismatch, alt-screen pane) degrade silently to an empty scrollback so the structural restore is never blocked. Adds Pane::inject_scrollback (default no-op) backed on LocalPane by a new TerminalState::prepend_primary_scrollback that always targets the primary screen so a pane briefly on alt screen at save time still gets its main-screen history when restored. After every envelope write, gc_kept_content_dirs sweeps session_content/ down to just the directories referenced by the two envelopes. Running processes (vim, claude-code, ssh) cannot be revived; this is text only above a fresh shell.
1 parent da849a0 commit b01637c

7 files changed

Lines changed: 617 additions & 25 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kaku-gui/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ wezterm-gui-subcommands.workspace = true
114114
wezterm-mux-server-impl.workspace = true
115115
wezterm-open-url.workspace = true
116116
# wezterm-ssh.workspace = true
117-
wezterm-term.workspace = true
117+
wezterm-term = { workspace = true, features = ["use_serde"] }
118+
bincode = "1"
118119
wezterm-toast-notification.workspace = true
119120
wgpu.workspace = true
120121
window-funcs.workspace = true

0 commit comments

Comments
 (0)