patch 8.2.0649: undo problem whn an InsertLeave autocommand resets undo
Problem: Undo problem whn an InsertLeave autocommand resets undo. (Kutsan
Kaplan)
Solution: Do not create a new undo block when leaving Insert mode.
diff --git a/src/edit.c b/src/edit.c
index 05518ce..7f4f765 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -5994,7 +5994,8 @@
// If u_savesub() was called then we are not prepared to start
// a new line. Call u_save() with no contents to fix that.
- if (tick != CHANGEDTICK(curbuf))
+ // Except when leaving Insert mode.
+ if (event != EVENT_INSERTLEAVE && tick != CHANGEDTICK(curbuf))
u_save(curwin->w_cursor.lnum, (linenr_T)(curwin->w_cursor.lnum + 1));
return r;