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
This commit is contained in:
parent
6e4bb5fbc5
commit
699c70ac91
|
@ -321,11 +321,10 @@ bool Buffer::redo(size_t count)
|
||||||
{
|
{
|
||||||
throw_if_read_only();
|
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;
|
return false;
|
||||||
|
|
||||||
kak_assert(m_current_undo_group.empty());
|
|
||||||
|
|
||||||
while (count-- != 0 and current_history_node().redo_child != HistoryId::Invalid)
|
while (count-- != 0 and current_history_node().redo_child != HistoryId::Invalid)
|
||||||
{
|
{
|
||||||
m_history_id = current_history_node().redo_child;
|
m_history_id = current_history_node().redo_child;
|
||||||
|
|
|
@ -1705,6 +1705,7 @@ void tabs_to_spaces(Context& context, NormalParams params)
|
||||||
Vector<Selection> tabs;
|
Vector<Selection> tabs;
|
||||||
Vector<String> spaces;
|
Vector<String> spaces;
|
||||||
ScopedSelectionEdition selection_edition{context};
|
ScopedSelectionEdition selection_edition{context};
|
||||||
|
ScopedEdition edition{context};
|
||||||
for (auto& sel : context.selections())
|
for (auto& sel : context.selections())
|
||||||
{
|
{
|
||||||
for (auto it = buffer.iterator_at(sel.min()),
|
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;
|
const ColumnCount tabstop = params.count == 0 ? opt_tabstop : params.count;
|
||||||
Vector<Selection> spaces;
|
Vector<Selection> spaces;
|
||||||
ScopedSelectionEdition selection_edition{context};
|
ScopedSelectionEdition selection_edition{context};
|
||||||
|
ScopedEdition edition{context};
|
||||||
for (auto& sel : context.selections())
|
for (auto& sel : context.selections())
|
||||||
{
|
{
|
||||||
for (auto it = buffer.iterator_at(sel.min()),
|
for (auto it = buffer.iterator_at(sel.min()),
|
||||||
|
|
1
test/regression/5124-assert-in-redo/cmd
Normal file
1
test/regression/5124-assert-in-redo/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
%du<a-@>U
|
1
test/regression/5124-assert-in-redo/in
Normal file
1
test/regression/5124-assert-in-redo/in
Normal file
|
@ -0,0 +1 @@
|
||||||
|
foo bar
|
1
test/regression/5124-assert-in-redo/out
Normal file
1
test/regression/5124-assert-in-redo/out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
foo bar
|
Loading…
Reference in New Issue
Block a user