- Added branching model for undo/redo, enabling multiple redo paths and branch selection. - Updated `UndoNode` to include `parent` and refined hierarchical navigation. - Extended `UndoSystem` with branching logic for redo operations, supporting sibling branch selection. - Overhauled tests to validate branching behavior and tree invariants. - Refined editor command logic for undo/redo with repeat counts and branch selection. - Enabled test-only introspection hooks for undo tree validation. - Updated CMake to include test definitions (`KTE_TESTS` flag).
22 lines
397 B
C++
22 lines
397 B
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
|
|
enum class UndoType : std::uint8_t {
|
|
Insert,
|
|
Delete,
|
|
Paste,
|
|
Newline,
|
|
DeleteRow,
|
|
};
|
|
|
|
struct UndoNode {
|
|
UndoType type{};
|
|
int row{};
|
|
int col{};
|
|
std::string text;
|
|
UndoNode *parent = nullptr; // previous state; null means pre-first-edit
|
|
UndoNode *child = nullptr; // next in current timeline
|
|
UndoNode *next = nullptr; // redo branch
|
|
}; |