Patch 8.0.0341
Problem:    When using complete() and typing a character undo is saved after
            the character was inserted. (Shougo)
Solution:   Save for undo before inserting the character.
Files:      src/edit.c, src/testdir/test_popup.vim


*** ../vim-8.0.0340/src/edit.c  2017-02-17 16:31:16.917294167 +0100
--- src/edit.c  2017-02-19 14:42:14.996457874 +0100
***************
*** 3583,3589 ****
--- 3583,3593 ----
  {
  #ifdef FEAT_MBYTE
      int               cc;
+ #endif
  
+     if (stop_arrow() == FAIL)
+       return;
+ #ifdef FEAT_MBYTE
      if (has_mbyte && (cc = (*mb_char2len)(c)) > 1)
      {
        char_u  buf[MB_MAXBYTES + 1];
*** ../vim-8.0.0340/src/testdir/test_popup.vim  2017-02-09 17:36:59.293629503 
+0100
--- src/testdir/test_popup.vim  2017-02-19 14:41:36.000740244 +0100
***************
*** 531,534 ****
--- 531,554 ----
    bw!
  endfunc
  
+ func CompleteUndo() abort
+   call complete(1, g:months)
+   return ''
+ endfunc
+ 
+ func Test_completion_can_undo()
+   inoremap <Right> <c-r>=CompleteUndo()<cr>
+   set completeopt+=noinsert,noselect
+ 
+   new
+   call feedkeys("a\<Right>a\<Esc>", 'xt')
+   call assert_equal('a', getline(1))
+   undo
+   call assert_equal('', getline(1))
+ 
+   bwipe!
+   set completeopt&
+   iunmap <Right>
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.0.0340/src/version.c       2017-02-19 13:54:57.996966935 +0100
--- src/version.c       2017-02-19 14:43:54.619736549 +0100
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     341,
  /**/

-- 
Engineers will go without food and hygiene for days to solve a problem.
(Other times just because they forgot.)
                                (Scott Adams - The Dilbert principle)

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui