feat(tui): add file save/close commands and session save handling

- Updated command specs: added `w`, `write`, `wq`, `x`, and `session save` with proper descriptions.
- Introduced `SaveStatus` enum and helper methods for path display and buffer labeling.
- Implemented `update_paths` in `Workspace` to keep title in sync with file paths.
- Added comprehensive `save_active_code_buffer` and enhanced `close_active_code_buffer` logic, including force‑close via `!`.
- Parsed force flag from commands (e.g., `:q!`) and routed commands to new save/close workflows.
- Integrated session save subcommand with optional description generation.
This commit is contained in:
2025-10-13 19:42:41 +02:00
parent ae0dd3fc51
commit c81d0f1593
3 changed files with 290 additions and 46 deletions

View File

@@ -14,7 +14,15 @@ const COMMANDS: &[CommandSpec] = &[
},
CommandSpec {
keyword: "q",
description: "Alias for quit",
description: "Close the active file",
},
CommandSpec {
keyword: "w",
description: "Save the active file",
},
CommandSpec {
keyword: "write",
description: "Alias for w",
},
CommandSpec {
keyword: "clear",
@@ -25,12 +33,16 @@ const COMMANDS: &[CommandSpec] = &[
description: "Alias for clear",
},
CommandSpec {
keyword: "w",
description: "Alias for write",
keyword: "save",
description: "Alias for w",
},
CommandSpec {
keyword: "save",
description: "Alias for write",
keyword: "wq",
description: "Save and close the active file",
},
CommandSpec {
keyword: "x",
description: "Alias for wq",
},
CommandSpec {
keyword: "load",
@@ -68,6 +80,10 @@ const COMMANDS: &[CommandSpec] = &[
keyword: "sessions",
description: "List saved sessions",
},
CommandSpec {
keyword: "session save",
description: "Save the current conversation",
},
CommandSpec {
keyword: "help",
description: "Show help documentation",