fix!: make :undo! notify buffer update callbacks (#20344)

When :undo! was introduced to Nvim the implementation of 'inccommand'
preview callback hasn't been fully decided yet, so not notifying buffer
update callbacks made sense for 'inccommand' preview callback in case it
needs to undo the changes itself.
Now it turns out that the undo-and-forget is done automatically for
'inccommand', so it doesn't make sense for :undo! to avoid notifying
buffer update callbacks anymore.
This commit is contained in:
zeertzjq
2022-09-26 07:15:07 +08:00
committed by GitHub
parent a6c9764eda
commit ac66f5af06
4 changed files with 25 additions and 7 deletions

View File

@@ -1771,16 +1771,16 @@ void u_redo(int count)
/// Undo and remove the branch from the undo tree.
/// Also moves the cursor (as a "normal" undo would).
bool u_undo_and_forget(int count)
///
/// @param do_buf_event If `true`, send the changedtick with the buffer updates
bool u_undo_and_forget(int count, bool do_buf_event)
{
if (curbuf->b_u_synced == false) {
u_sync(true);
count = 1;
}
undo_undoes = true;
u_doit(count, true,
// Don't send nvim_buf_lines_event for u_undo_and_forget().
false);
u_doit(count, true, do_buf_event);
if (curbuf->b_u_curhead == NULL) {
// nothing was undone.