diff options
| author | Maxime Coste <mawww@kakoune.org> | 2023-06-17 17:30:43 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2023-06-17 17:31:57 +1000 |
| commit | 5901d2e06b7c43fd0e6156a49761b81b747ea908 (patch) | |
| tree | 46a48c3f3341a7673f96bfb152c6f05703e04465 /src/buffer_utils.cc | |
| parent | b2a853cfc2e52559b70d0ad3bfc4a49f3ed16833 (diff) | |
Revert "Switch undo storage from a tree to a plain list"
Moving across history moved to <c-j>/<c-k> to keep <a-u>/<a-U>
for selection undo/redo
This reverts commit e0d33f51b36c9f0be7ae2467dab455d211bbf561.
Diffstat (limited to 'src/buffer_utils.cc')
| -rw-r--r-- | src/buffer_utils.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index 9ff1f4ce..47f9a88b 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -301,6 +301,14 @@ void write_to_debug_buffer(StringView str) } +auto to_string(Buffer::HistoryId id) +{ + using Result = decltype(to_string(size_t{})); + if (id == Buffer::HistoryId::Invalid) + return Result{1, "-"}; + return to_string(static_cast<size_t>(id)); +} + static String modification_as_string(const Buffer::Modification& modification) { return format("{}{}.{}|{}", @@ -315,7 +323,9 @@ Vector<String> history_as_strings(const Vector<Buffer::HistoryNode>& history) for (auto& node : history) { auto seconds = std::chrono::duration_cast<std::chrono::seconds>(node.committed.time_since_epoch()); + res.push_back(to_string(node.parent)); res.push_back(to_string(seconds.count())); + res.push_back(to_string(node.redo_child)); for (auto& modification : node.undo_group) res.push_back(modification_as_string(modification)); }; |
