- Added `test_reflow_undo.cc` to validate undo/redo workflows for reflow operations. - Introduced `UndoType::InsertRow` in `UndoSystem` for tracking row insertion changes in undo history. - Updated `UndoNode.h` and `UndoSystem.cc` to support row insertion as a standalone undo step. - Enhanced reflow paragraph functionality to properly record undo/redo actions for both row deletion and insertion. - Enabled legacy/extended undo tests in `test_undo.cc` for comprehensive validation. - Updated `CMakeLists.txt` to include new test file in the build target.
24 lines
504 B
C++
24 lines
504 B
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
|
|
enum class UndoType : std::uint8_t {
|
|
Insert,
|
|
Delete,
|
|
Paste,
|
|
Newline,
|
|
DeleteRow,
|
|
InsertRow,
|
|
};
|
|
|
|
struct UndoNode {
|
|
UndoType type{};
|
|
int row{};
|
|
int col{};
|
|
std::uint64_t group_id = 0; // 0 means ungrouped; non-zero means undo/redo as an atomic group
|
|
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
|
|
}; |