Patch 8.2.1673
Problem:    complete_info() selected index has an invalid value. (Ben Jackson)
Solution:   Set the index when there is only one match. (closes #6945)
            Add test for complete_info().
Files:      src/insexpand.c, src/testdir/test_ins_complete.vim


*** ../vim-8.2.1672/src/insexpand.c     2020-06-12 22:59:07.266097201 +0200
--- src/insexpand.c     2020-09-12 22:29:44.252132230 +0200
***************
*** 4009,4014 ****
--- 4009,4015 ----
        {
            edit_submode_extra = (char_u *)_("The only match");
            edit_submode_highl = HLF_COUNT;
+           compl_curr_match->cp_number = 0;
        }
        else
        {
*** ../vim-8.2.1672/src/testdir/test_ins_complete.vim   2020-08-12 
18:50:31.879655802 +0200
--- src/testdir/test_ins_complete.vim   2020-09-12 22:52:09.486473001 +0200
***************
*** 313,318 ****
--- 313,336 ----
    au! CompleteDone
  endfunc
  
+ func CompleteTest(findstart, query)
+   if a:findstart
+     return col('.')
+   endif
+   return ['matched']
+ endfunc
+ 
+ func Test_completefunc_info()
+   new
+   set completeopt=menuone
+   set completefunc=CompleteTest
+   call 
feedkeys("i\<C-X>\<C-U>\<C-R>\<C-R>=string(complete_info())\<CR>\<ESC>", "tx")
+   call assert_equal("matched{'pum_visible': 1, 'mode': 'function', 
'selected': -1, 'items': [{'word': 'matched', 'menu': '', 'user_data': '', 
'info': '', 'kind': '', 'abbr': ''}]}", getline(1))
+   bwipe!
+   set completeopt&
+   set completefunc&
+ endfunc
+ 
  " Check that when using feedkeys() typeahead does not interrupt searching for
  " completions.
  func Test_compl_feedkeys()
*** ../vim-8.2.1672/src/version.c       2020-09-12 22:09:55.891607873 +0200
--- src/version.c       2020-09-12 22:38:37.253791943 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1673,
  /**/

-- 
Citizens are not allowed to attend a movie house or theater nor ride in a
public streetcar within at least four hours after eating garlic.
                [real standing law in Indiana, United States of America]

 /// 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/202009122053.08CKrbsK1222938%40masaka.moolenaar.net.

Raspunde prin e-mail lui