persist terminal directories on restart#101
Conversation
Prompt: When exiting the app, save the state of the terminals (spawned, in which directory) in the persistence.toml file (e.g., terminal_1_2: "/Users/local/dev"); on running the app, spawn the terminals that were running the previous time in the respective directories. If the new grid layout doesn't have terminals at such positions (e.g., the user has decreased the number of cells), ignore those values and remove them from persistence.toml. Solution: Added terminal state persistence with grid pruning and restore on startup; duplicated TOML data to avoid ownership bugs and aligned with Zig 0.15 ArrayList/io APIs. Seed cwd on spawn, persisted dirs on exit, and documented behavior and pitfalls; README/CLAUDE updated and builds/tests pass.
There was a problem hiding this comment.
Pull request overview
This PR adds persistence for terminal working directories, ensuring running terminals restore to their previous directories when the application restarts.
Changes:
- Added terminal directory persistence using
terminal_<row>_<col>keys in persistence.toml - Implemented pruning logic to remove out-of-bounds terminal entries when grid dimensions change
- Added
seedCwdandreplaceCwdPathmethods to properly track and manage terminal working directories
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/session/state.zig | Added cwd tracking methods and basename handling for terminal directories |
| src/main.zig | Integrated terminal restoration from persistence at startup and saving on exit |
| src/config.zig | Implemented Persistence terminal storage with pruning, collection, and serialization logic |
| README.md | Documented the new terminal state persistence feature with example |
| CLAUDE.md | Added implementation notes about Zig 0.15 API changes and TOML parser pitfalls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b27939aae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Summary