diff --git a/src/context.cc b/src/context.cc index 03cf1586..b3b82938 100644 --- a/src/context.cc +++ b/src/context.cc @@ -211,7 +211,11 @@ Vector Context::selections_content() const void Context::begin_edition() { if (m_edition_level >= 0) + { + if (m_edition_level == 0) + m_edition_timestamp = buffer().timestamp(); ++m_edition_level; + } } void Context::end_edition() @@ -220,7 +224,8 @@ void Context::end_edition() return; kak_assert(m_edition_level != 0); - if (m_edition_level == 1) + if (m_edition_level == 1 and + buffer().timestamp() != m_edition_timestamp) buffer().commit_undo_group(); --m_edition_level; diff --git a/src/context.hh b/src/context.hh index e1924a21..14543946 100644 --- a/src/context.hh +++ b/src/context.hh @@ -134,6 +134,7 @@ private: void begin_edition(); void end_edition(); int m_edition_level = 0; + size_t m_edition_timestamp = 0; friend struct ScopedEdition; diff --git a/test/regression/0-spurious-undo-group-on-external/cmd b/test/regression/0-spurious-undo-group-on-external/cmd new file mode 100644 index 00000000..0fe9192e --- /dev/null +++ b/test/regression/0-spurious-undo-group-on-external/cmd @@ -0,0 +1 @@ +Abarbazu diff --git a/test/regression/0-spurious-undo-group-on-external/in b/test/regression/0-spurious-undo-group-on-external/in new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/test/regression/0-spurious-undo-group-on-external/in @@ -0,0 +1 @@ +foo diff --git a/test/regression/0-spurious-undo-group-on-external/out b/test/regression/0-spurious-undo-group-on-external/out new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/test/regression/0-spurious-undo-group-on-external/out @@ -0,0 +1 @@ +foo diff --git a/test/regression/0-spurious-undo-group-on-external/rc b/test/regression/0-spurious-undo-group-on-external/rc new file mode 100644 index 00000000..7b43b8bc --- /dev/null +++ b/test/regression/0-spurious-undo-group-on-external/rc @@ -0,0 +1,2 @@ +decl int my_option +hook global InsertChar r %{ eval -buffer %val{buffile} %{ eval "set buffer my_option 1" } }