- Introduced SwapManager for sidecar journaling of buffer mutations, with a safe recovery mechanism. - Added group undo/redo functionality, allowing atomic grouping of related edits. - Implemented `SwapRecorder` and integrated it as a callback interface for mutations. - Added unit tests for swap journaling (save/load/replay) and undo grouping. - Refactored undo to support group tracking and ID management. - Updated CMake to include the new tests and swap journaling logic.
19 lines
531 B
C++
19 lines
531 B
C++
// SwapRecorder.h - minimal swap journal recording interface for Buffer mutations
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string_view>
|
|
|
|
namespace kte {
|
|
// SwapRecorder is a tiny, non-blocking callback interface.
|
|
// Implementations must return quickly; Buffer calls these hooks after a
|
|
// mutation succeeds.
|
|
class SwapRecorder {
|
|
public:
|
|
virtual ~SwapRecorder() = default;
|
|
|
|
virtual void OnInsert(int row, int col, std::string_view bytes) = 0;
|
|
|
|
virtual void OnDelete(int row, int col, std::size_t len) = 0;
|
|
};
|
|
} // namespace kte
|