Add swap file journaling for crash recovery.

- Introduced `SwapManager` for buffering and writing incremental edits to sidecar `.kte.swp` files.
- Implemented basic operations: insertion, deletion, split, join, and checkpointing.
- Added recovery design doc (`docs/plans/swap-files.md`).
- Updated editor initialization to integrate `SwapManager` instance for crash recovery across buffers.
This commit is contained in:
2025-12-04 08:48:32 -08:00
parent 495183ebd2
commit 78b9345799
24 changed files with 1933 additions and 545 deletions

View File

@@ -6,6 +6,8 @@
#include "Command.h"
class Editor; // fwd decl
// Result of translating raw input into an editor command.
struct MappedInput {
@@ -19,6 +21,10 @@ class InputHandler {
public:
virtual ~InputHandler() = default;
// Optional: attach current Editor so handlers can consult editor state (e.g., universal argument)
// Default implementation does nothing.
virtual void Attach(Editor *) {}
// Poll for input and translate it to a command. Non-blocking.
// Returns true if a command is available in 'out'. Returns false if no input.
virtual bool Poll(MappedInput &out) = 0;