Patch 8.0.1482
Problem:    Using feedkeys() does not work to test Insert mode completion.
            (Lifepillar)
Solution:   Do not check for typed keys when executing :normal or feedkeys().
            Fix thesaurus completion not working when 'complete' is empty.
Files:      src/edit.c, src/testdir/test_ins_complete.vim,
            src/testdir/test_popup.vim, src/testdir/test_edit.vim


*** ../vim-8.0.1481/src/edit.c  2018-02-09 12:29:52.335647866 +0100
--- src/edit.c  2018-02-09 14:58:54.261416643 +0100
***************
*** 1454,1460 ****
            /* if 'complete' is empty then plain ^P is no longer special,
             * but it is under other ^X modes */
            if (*curbuf->b_p_cpt == NUL
!                   && ctrl_x_mode != 0
                    && !(compl_cont_status & CONT_LOCAL))
                goto normalchar;
  
--- 1454,1461 ----
            /* if 'complete' is empty then plain ^P is no longer special,
             * but it is under other ^X modes */
            if (*curbuf->b_p_cpt == NUL
!                   && (ctrl_x_mode == CTRL_X_NORMAL
!                       || ctrl_x_mode == CTRL_X_WHOLE_LINE)
                    && !(compl_cont_status & CONT_LOCAL))
                goto normalchar;
  
***************
*** 1568,1575 ****
        /* If typed something may trigger CursorHoldI again. */
        if (c != K_CURSORHOLD
  # ifdef FEAT_COMPL_FUNC
!           /* but not in CTRL-X mode, a script can't restore the state */
!           && ctrl_x_mode == 0
  # endif
               )
            did_cursorhold = FALSE;
--- 1569,1576 ----
        /* If typed something may trigger CursorHoldI again. */
        if (c != K_CURSORHOLD
  # ifdef FEAT_COMPL_FUNC
!               /* but not in CTRL-X mode, a script can't restore the state */
!               && ctrl_x_mode == CTRL_X_NORMAL
  # endif
               )
            did_cursorhold = FALSE;
***************
*** 1582,1588 ****
  #ifdef FEAT_CINDENT
        if (can_cindent && cindent_on()
  # ifdef FEAT_INS_EXPAND
!               && ctrl_x_mode == 0
  # endif
           )
        {
--- 1583,1589 ----
  #ifdef FEAT_CINDENT
        if (can_cindent && cindent_on()
  # ifdef FEAT_INS_EXPAND
!               && ctrl_x_mode == CTRL_X_NORMAL
  # endif
           )
        {
***************
*** 5020,5031 ****
  ins_compl_check_keys(int frequency, int in_compl_func)
  {
      static int        count = 0;
  
!     int           c;
! 
!     /* Don't check when reading keys from a script.  That would break the test
!      * scripts */
!     if (using_script())
        return;
  
      /* Only do this at regular intervals */
--- 5021,5032 ----
  ins_compl_check_keys(int frequency, int in_compl_func)
  {
      static int        count = 0;
+     int               c;
  
!     /* Don't check when reading keys from a script, :normal or feedkeys().
!      * That would break the test scripts.  But do check for keys when called
!      * from complete_check(). */
!     if (!in_compl_func && (using_script() || ex_normal_busy))
        return;
  
      /* Only do this at regular intervals */
*** ../vim-8.0.1481/src/testdir/test_ins_complete.vim   2017-11-05 
20:59:12.528905134 +0100
--- src/testdir/test_ins_complete.vim   2018-02-09 14:01:29.353618093 +0100
***************
*** 116,118 ****
--- 116,129 ----
    delfunc Omni
    set omnifunc=
  endfunc
+ 
+ " Check that when using feedkeys() typeahead does not interrupt searching for
+ " completions.
+ func Test_compl_feedkeys()
+   new
+   set completeopt=menuone,noselect
+   call feedkeys("ajump ju\<C-X>\<C-N>\<C-P>\<ESC>", "tx")
+   call assert_equal("jump jump", getline(1))
+   bwipe!
+   set completeopt&
+ endfunc
*** ../vim-8.0.1481/src/testdir/test_popup.vim  2017-11-26 16:53:12.323475402 
+0100
--- src/testdir/test_popup.vim  2018-02-09 14:32:05.100902649 +0100
***************
*** 693,699 ****
    norm! gt
    call assert_equal(0, &previewwindow)
    norm! gT
!   call assert_equal(12, tabpagenr('$'))
    tabonly
    pclose
    augroup MyBufAdd
--- 693,699 ----
    norm! gt
    call assert_equal(0, &previewwindow)
    norm! gT
!   call assert_equal(10, tabpagenr('$'))
    tabonly
    pclose
    augroup MyBufAdd
*** ../vim-8.0.1481/src/testdir/test_edit.vim   2017-10-27 01:34:55.089306875 
+0200
--- src/testdir/test_edit.vim   2018-02-09 14:37:30.562654990 +0100
***************
*** 631,641 ****
    call feedkeys("cct\<c-x>\<c-l>\<c-n>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
    call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<esc>", 'tnix')
-   call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
-   call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, 
'$'))
!   call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, 
'$'))
    call feedkeys("cct\<c-x>\<c-l>\<c-p>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, 
'$'))
    call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<esc>", 'tnix')
--- 631,641 ----
    call feedkeys("cct\<c-x>\<c-l>\<c-n>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
    call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, 
'$'))
!   call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, 
'$'))
+   call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
+   call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
    call feedkeys("cct\<c-x>\<c-l>\<c-p>\<esc>", 'tnix')
    call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, 
'$'))
    call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<esc>", 'tnix')
***************
*** 1357,1363 ****
    let save_columns = &columns
    " Need at least about 1100 columns to reproduce the problem.
    set columns=2000
-   call assert_equal(2000, &columns)
    set noswapfile
  
    let longfilename = longdirname . '/' . repeat('a', 255)
--- 1357,1362 ----
*** ../vim-8.0.1481/src/version.c       2018-02-09 12:29:52.335647866 +0100
--- src/version.c       2018-02-09 15:04:43.418937888 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1482,
  /**/

-- 
GUARD #1:  What -- a swallow carrying a coconut?
ARTHUR:    It could grip it by the husk!
GUARD #1:  It's not a question of where he grips it!  It's a simple question
           of weight ratios!  A five ounce bird could not carry a 1 pound
           coconut.
                                  The Quest for the Holy Grail (Monty Python)

 /// 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