summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-22 19:25:33 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-22 19:25:33 +0100
commit15eedf1d621d980cb40f50cc6a78a09ab94388c7 (patch)
treed78a8504575069b3588f38359d83d80d1d8a79fa
parent7a40ea2138102545848ea86a361f1b8dec7552b5 (diff)
patch 8.0.0220: completion of highlight names misses a few valuesv8.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.
-rw-r--r--src/syntax.c13
-rw-r--r--src/testdir/test_cmdline.vim28
-rw-r--r--src/version.c2
3 files changed, 36 insertions, 7 deletions
diff --git a/src/syntax.c b/src/syntax.c
index d5c2e77128..dbadb70fde 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -9956,6 +9956,13 @@ highlight_list_two(int cnt, int attr)
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,12 +9975,6 @@ get_highlight_name(expand_T *xp UNUSED, int idx)
&& 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;
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index abeb609eaa..279a1681c4 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -25,8 +25,34 @@ func Test_complete_wildmenu()
set nowildmenu
endfunc
+func Test_match_completion()
+ if !has('cmdline_compl')
+ return
+ endif
+ hi Aardig ctermfg=green
+ call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"match Aardig', getreg(':'))
+ call feedkeys(":match \<S-Tab>\<Home>\"\<CR>", '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 \<Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"hi Aardig', getreg(':'))
+ call feedkeys(":hi li\<S-Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"hi link', getreg(':'))
+ call feedkeys(":hi d\<S-Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"hi default', getreg(':'))
+ call feedkeys(":hi c\<S-Tab>\<Home>\"\<CR>", 'xt')
+ call assert_equal('"hi clear', getreg(':'))
+endfunc
+
func Test_expr_completion()
- if !(has('cmdline_compl') && has('eval'))
+ if !has('cmdline_compl')
return
endif
for cmd in [
diff --git a/src/version.c b/src/version.c
index 90f056b690..84cb94030c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 220,
+/**/
219,
/**/
218,