To: vim_dev@googlegroups.com Subject: Patch 8.0.0220 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0220 Problem: Completion for :match does not show "none" and other missing highlight names. Solution: Skip over cleared entries before checking the index to be at the end. Files: src/syntax.c, src/testdir/test_cmdline.vim *** ../vim-8.0.0219/src/syntax.c 2017-01-22 15:28:47.771002874 +0100 --- src/syntax.c 2017-01-22 19:15:52.880238502 +0100 *************** *** 9956,9961 **** --- 9956,9968 ---- char_u * get_highlight_name(expand_T *xp UNUSED, int idx) { + if (idx < 0) + return NULL; + /* Items are never removed from the table, skip the ones that were cleared. + */ + while (idx < highlight_ga.ga_len && HL_TABLE()[idx].sg_cleared) + ++idx; + #ifdef FEAT_CMDL_COMPL if (idx == highlight_ga.ga_len && include_none != 0) return (char_u *)"none"; *************** *** 9968,9979 **** && include_link != 0) return (char_u *)"clear"; #endif - if (idx < 0) - return NULL; - /* Items are never removed from the table, skip the ones that were cleared. - */ - while (idx < highlight_ga.ga_len && HL_TABLE()[idx].sg_cleared) - ++idx; if (idx >= highlight_ga.ga_len) return NULL; return HL_TABLE()[idx].sg_name; --- 9975,9980 ---- *** ../vim-8.0.0219/src/testdir/test_cmdline.vim 2017-01-22 16:46:52.253278433 +0100 --- src/testdir/test_cmdline.vim 2017-01-22 19:21:35.310030919 +0100 *************** *** 25,32 **** set nowildmenu endfunc func Test_expr_completion() ! if !(has('cmdline_compl') && has('eval')) return endif for cmd in [ --- 25,58 ---- set nowildmenu endfunc + func Test_match_completion() + if !has('cmdline_compl') + return + endif + hi Aardig ctermfg=green + call feedkeys(":match \\\"\", 'xt') + call assert_equal('"match Aardig', getreg(':')) + call feedkeys(":match \\\"\", 'xt') + call assert_equal('"match none', getreg(':')) + endfunc + + func Test_highlight_completion() + if !has('cmdline_compl') + return + endif + hi Aardig ctermfg=green + call feedkeys(":hi \\\"\", 'xt') + call assert_equal('"hi Aardig', getreg(':')) + call feedkeys(":hi li\\\"\", 'xt') + call assert_equal('"hi link', getreg(':')) + call feedkeys(":hi d\\\"\", 'xt') + call assert_equal('"hi default', getreg(':')) + call feedkeys(":hi c\\\"\", 'xt') + call assert_equal('"hi clear', getreg(':')) + endfunc + func Test_expr_completion() ! if !has('cmdline_compl') return endif for cmd in [ *** ../vim-8.0.0219/src/version.c 2017-01-22 18:34:53.684030783 +0100 --- src/version.c 2017-01-22 19:19:10.810962193 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 220, /**/ -- Not too long ago, a program was something you watched on TV... /// 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 ///