mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.0513: getting name of cleared highlight group is wrong
Problem: Getting name of cleared highlight group is wrong. (Matt Wozniski) Solution: Only skip over cleared names for completion. (closes #1592) Also fix that a cleared group causes duplicate completions.
This commit is contained in:
20
src/syntax.c
20
src/syntax.c
@@ -9949,17 +9949,27 @@ highlight_list_two(int cnt, int attr)
|
||||
|| defined(FEAT_SIGNS) || defined(PROTO)
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the list of group names.
|
||||
* Also used for synIDattr() function.
|
||||
*/
|
||||
char_u *
|
||||
get_highlight_name(expand_T *xp UNUSED, int idx)
|
||||
{
|
||||
return get_highlight_name_ext(xp, idx, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain a highlight group name.
|
||||
* When "skip_cleared" is TRUE don't return a cleared entry.
|
||||
*/
|
||||
char_u *
|
||||
get_highlight_name_ext(expand_T *xp UNUSED, int idx, int skip_cleared)
|
||||
{
|
||||
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;
|
||||
|
||||
/* Items are never removed from the table, skip the ones that were
|
||||
* cleared. */
|
||||
if (skip_cleared && idx < highlight_ga.ga_len && HL_TABLE()[idx].sg_cleared)
|
||||
return (char_u *)"";
|
||||
|
||||
#ifdef FEAT_CMDL_COMPL
|
||||
if (idx == highlight_ga.ga_len && include_none != 0)
|
||||
|
Reference in New Issue
Block a user