1
0
forked from aniani/vim

patch 8.2.4942: error when setting 'filetype' in help file again

Problem:    Error when setting 'filetype' in help file again.
Solution:   Deal with text property type already existing. (closes #10409)
This commit is contained in:
Bram Moolenaar
2022-05-12 17:24:49 +01:00
parent 82444cefa3
commit de216732d4
2 changed files with 13 additions and 5 deletions

View File

@@ -9,11 +9,17 @@ export def HighlightGroups()
while getline(lnum) !~ '===' && lnum < line('$')
var word: string = getline(lnum)->matchstr('^\w\+\ze\t')
if word->hlexists()
prop_type_add('help-hl-' .. word, {
bufnr: buf,
highlight: word,
combine: false,
})
var name = 'help-hl-' .. word
if prop_type_list({bufnr: buf})->match(name) == -1
prop_type_add('help-hl-' .. word, {
bufnr: buf,
highlight: word,
combine: false,
})
else
# was called before, delete existing properties
prop_remove({type: name, bufnr: buf})
endif
prop_add(lnum, 1, {length: word->strlen(), type: 'help-hl-' .. word})
endif
++lnum

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4942,
/**/
4941,
/**/