To: vim_dev@googlegroups.com Subject: Patch 8.2.1673 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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\\\\=string(complete_info())\\", "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 -- Bram@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 ///