summaryrefslogtreecommitdiff
path: root/src/syntax.c
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 /src/syntax.c
parent7a40ea2138102545848ea86a361f1b8dec7552b5 (diff)
downloadvim-git-15eedf1d621d980cb40f50cc6a78a09ab94388c7.tar.gz
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.
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/syntax.c b/src/syntax.c
index d5c2e7712..dbadb70fd 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;