Patch 8.0.0043 (after 8.0.0041)
Problem:    When using Insert mode completion with 'completeopt' containing
            "noinsert" with CTRL-N the change is not saved for undo.  (Tommy
            Allen)
Solution:   Call stop_arrow() before inserting for any key.
Files:      src/edit.c, src/testdir/test_popup.vim


*** ../vim-8.0.0042/src/edit.c  2016-10-17 20:46:59.342729937 +0200
--- src/edit.c  2016-10-18 12:51:59.119990870 +0200
***************
*** 4634,4647 ****
      static void
  ins_compl_delete(void)
  {
!     int           i;
  
      /*
       * In insert mode: Delete the typed part.
       * In replace mode: Put the old characters back, if any.
       */
!     i = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0);
!     backspace_until_column(i);
  
      /* TODO: is this sufficient for redrawing?  Redrawing everything causes
       * flicker, thus we can't do that. */
--- 4634,4652 ----
      static void
  ins_compl_delete(void)
  {
!     int           col;
  
      /*
       * In insert mode: Delete the typed part.
       * In replace mode: Put the old characters back, if any.
       */
!     col = compl_col + (compl_cont_status & CONT_ADDING ? compl_length : 0);
!     if ((int)curwin->w_cursor.col > col)
!     {
!       if (stop_arrow() == FAIL)
!           return;
!       backspace_until_column(col);
!     }
  
      /* TODO: is this sufficient for redrawing?  Redrawing everything causes
       * flicker, thus we can't do that. */
***************
*** 5059,5066 ****
--- 5064,5074 ----
      colnr_T   curs_col;           /* cursor column */
      int               n;
      int               save_w_wrow;
+     int               insert_match;
  
      compl_direction = ins_compl_key2dir(c);
+     insert_match = ins_compl_use_match(c);
+ 
      if (!compl_started)
      {
        /* First time we hit ^N or ^P (in a row, I mean) */
***************
*** 5486,5491 ****
--- 5494,5501 ----
        edit_submode_extra = NULL;
        out_flush();
      }
+     else if (insert_match && stop_arrow() == FAIL)
+       return FAIL;
  
      compl_shown_match = compl_curr_match;
      compl_shows_dir = compl_direction;
***************
*** 5494,5501 ****
       * Find next match (and following matches).
       */
      save_w_wrow = curwin->w_wrow;
!     n = ins_compl_next(TRUE, ins_compl_key2count(c),
!                                               ins_compl_use_match(c), FALSE);
  
      /* may undisplay the popup menu */
      ins_compl_upd_pum();
--- 5504,5510 ----
       * Find next match (and following matches).
       */
      save_w_wrow = curwin->w_wrow;
!     n = ins_compl_next(TRUE, ins_compl_key2count(c), insert_match, FALSE);
  
      /* may undisplay the popup menu */
      ins_compl_upd_pum();
*** ../vim-8.0.0042/src/testdir/test_popup.vim  2016-10-17 20:46:59.342729937 
+0200
--- src/testdir/test_popup.vim  2016-10-18 12:31:27.581067689 +0200
***************
*** 427,432 ****
--- 427,437 ----
    call feedkeys("u", 'xt')
    call assert_equal('bbb', getline(2))
  
+   call feedkeys("A\<Right>\<C-N>\<Esc>", 'xt')
+   call assert_equal('January', getline(2))
+   call feedkeys("u", 'xt')
+   call assert_equal('bbb', getline(2))
+ 
    iunmap <Right>
    set completeopt&
    q!
*** ../vim-8.0.0042/src/version.c       2016-10-17 20:46:59.342729937 +0200
--- src/version.c       2016-10-18 13:01:18.947864767 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     43,
  /**/

-- 
A parent can be arrested if his child cannot hold back a burp during a church
service.
                [real standing law in Nebraska, United States of America]

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui