Patch 8.2.0649
Problem:    Undo problem when an InsertLeave autocommand resets undo. (Kutsan
            Kaplan)
Solution:   Do not create a new undo block when leaving Insert mode.
Files:      src/edit.c, src/testdir/test_edit.vim


*** ../vim-8.2.0648/src/edit.c  2020-04-21 22:01:11.089499502 +0200
--- src/edit.c  2020-04-27 19:54:45.027222708 +0200
***************
*** 5994,6000 ****
  
      // 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))
        u_save(curwin->w_cursor.lnum, (linenr_T)(curwin->w_cursor.lnum + 1));
  
      return r;
--- 5994,6001 ----
  
      // If u_savesub() was called then we are not prepared to start
      // a new line.  Call u_save() with no contents to fix that.
!     // 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;
*** ../vim-8.2.0648/src/testdir/test_edit.vim   2020-04-21 22:01:11.089499502 
+0200
--- src/testdir/test_edit.vim   2020-04-27 19:52:21.603700943 +0200
***************
*** 1444,1450 ****
    call delete('XAltFile')
  endfunc
  
! func Test_leave_insert_autocmd()
    new
    au InsertLeave * let g:did_au = 1
    let g:did_au = 0
--- 1444,1450 ----
    call delete('XAltFile')
  endfunc
  
! func Test_edit_InsertLeave()
    new
    au InsertLeave * let g:did_au = 1
    let g:did_au = 0
***************
*** 1474,1479 ****
--- 1474,1494 ----
    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
*** ../vim-8.2.0648/src/version.c       2020-04-27 19:28:58.536998688 +0200
--- src/version.c       2020-04-27 19:53:59.803373176 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     649,
  /**/

-- 
Don't Panic!
                -- The Hitchhiker's Guide to the Galaxy

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202004271819.03RIJF1n019682%40masaka.moolenaar.net.

Raspunde prin e-mail lui