Only commit undo groups when buffer was modified
This fixes an interaction with kak-lsp that would trigger undo group commit when setting a buffer option value.
This commit is contained in:
parent
beb5d00992
commit
d3be78cca2
|
@ -211,7 +211,11 @@ Vector<String> 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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
1
test/regression/0-spurious-undo-group-on-external/cmd
Normal file
1
test/regression/0-spurious-undo-group-on-external/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
Abarbaz<esc>u
|
1
test/regression/0-spurious-undo-group-on-external/in
Normal file
1
test/regression/0-spurious-undo-group-on-external/in
Normal file
|
@ -0,0 +1 @@
|
|||
foo
|
1
test/regression/0-spurious-undo-group-on-external/out
Normal file
1
test/regression/0-spurious-undo-group-on-external/out
Normal file
|
@ -0,0 +1 @@
|
|||
foo
|
2
test/regression/0-spurious-undo-group-on-external/rc
Normal file
2
test/regression/0-spurious-undo-group-on-external/rc
Normal file
|
@ -0,0 +1,2 @@
|
|||
decl int my_option
|
||||
hook global InsertChar r %{ eval -buffer %val{buffile} %{ eval "set buffer my_option 1" } }
|
Loading…
Reference in New Issue
Block a user