summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-03-23 20:02:16 +1100
committerMaxime Coste <mawww@kakoune.org>2024-03-23 20:07:41 +1100
commit699c70ac91304078cdf4a8fee6d1737553f96606 (patch)
treee83a59ff972d54f9026e70c901e7c2e867d67e43 /src
parent6e4bb5fbc5bc01c9143e40e3f4cb5b48efb020ec (diff)
Add some missing ScopedEdition and fix redo
tabs <-> space conversion functions did not create a ScopedEdition leading to uncommited modifications. Fixing this did fix the interactive error, but that error still existed in non interactive context so redo now considers there there is no redo child if there are uncommited modifiations (which is correct as this means we are currently creating a new leaf in the undo tree) Fixes #5124
Diffstat (limited to 'src')
-rw-r--r--src/buffer.cc5
-rw-r--r--src/normal.cc2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index ffb45e18..ada61ad8 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -321,11 +321,10 @@ bool Buffer::redo(size_t count)
{
throw_if_read_only();
- if (current_history_node().redo_child == HistoryId::Invalid)
+ if (current_history_node().redo_child == HistoryId::Invalid or
+ not m_current_undo_group.empty())
return false;
- kak_assert(m_current_undo_group.empty());
-
while (count-- != 0 and current_history_node().redo_child != HistoryId::Invalid)
{
m_history_id = current_history_node().redo_child;
diff --git a/src/normal.cc b/src/normal.cc
index 03e7895c..2d80d26f 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -1705,6 +1705,7 @@ void tabs_to_spaces(Context& context, NormalParams params)
Vector<Selection> tabs;
Vector<String> spaces;
ScopedSelectionEdition selection_edition{context};
+ ScopedEdition edition{context};
for (auto& sel : context.selections())
{
for (auto it = buffer.iterator_at(sel.min()),
@@ -1730,6 +1731,7 @@ void spaces_to_tabs(Context& context, NormalParams params)
const ColumnCount tabstop = params.count == 0 ? opt_tabstop : params.count;
Vector<Selection> spaces;
ScopedSelectionEdition selection_edition{context};
+ ScopedEdition edition{context};
for (auto& sel : context.selections())
{
for (auto it = buffer.iterator_at(sel.min()),