Problem: Undo problem whn an InsertLeave autocommand resets undo. (Kutsan
Kaplan)
Solution: Do not create a new undo block when leaving Insert mode.
// 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;
call delete('XAltFile')
endfunc
-func Test_leave_insert_autocmd()
+func Test_edit_InsertLeave()
new
au InsertLeave * let g:did_au = 1
let g:did_au = 0
iunmap x
endfunc
+func Test_edit_InsertLeave_undo()
+ new XtestUndo
+ set undofile
+ au InsertLeave * wall
+ exe "normal ofoo\<Esc>"
+ call assert_equal(2, line('$'))
+ normal u
+ call assert_equal(1, line('$'))
+
+ bwipe!
+ au! InsertLeave
+ call delete('XtestUndo')
+ set undofile&
+endfunc
+
" Test for inserting characters using CTRL-V followed by a number.
func Test_edit_special_chars()
new
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 649,
/**/
648,
/**/