1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-10-26 13:40:10 +03:00

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:
Maxime Coste 2024-03-23 20:02:16 +11:00
parent 6e4bb5fbc5
commit 699c70ac91
5 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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()),

View File

@ -0,0 +1 @@
%du<a-@>U

View File

@ -0,0 +1 @@
foo bar

View File

@ -0,0 +1 @@
foo bar