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:
@@ -25,8 +25,9 @@ public:
|
||||
void SetHighlighter(std::unique_ptr<LanguageHighlighter> hl);
|
||||
|
||||
// Retrieve highlights for a given line and buffer version.
|
||||
// Returns a copy to avoid lifetime issues across threads/renderers.
|
||||
// If cache is stale, recompute using the current highlighter.
|
||||
const LineHighlight &GetLine(const Buffer &buf, int row, std::uint64_t buf_version) const;
|
||||
LineHighlight GetLine(const Buffer &buf, int row, std::uint64_t buf_version) const;
|
||||
|
||||
// Invalidate cached lines from row (inclusive)
|
||||
void InvalidateFrom(int row);
|
||||
@@ -70,6 +71,10 @@ private:
|
||||
std::uint64_t version{0};
|
||||
int start_row{0};
|
||||
int end_row{0}; // inclusive
|
||||
// Visible rows to skip touching in the background (inclusive range).
|
||||
// These are computed synchronously by PrefetchViewport.
|
||||
int skip_first{0};
|
||||
int skip_last{-1};
|
||||
};
|
||||
|
||||
mutable std::condition_variable cv_;
|
||||
|
||||
Reference in New Issue
Block a user