diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-05-12 17:24:49 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-05-12 17:24:49 +0100 |
commit | de216732d45caa87e6f08f4319aa71e805a89a0e (patch) | |
tree | 8ada7637960c13d4e99c68c72acbec599b8412f7 /runtime | |
parent | 82444cefa3fef87624a078ea86a72af7ef4ef42e (diff) |
patch 8.2.4942: error when setting 'filetype' in help file againv8.2.4942
Problem: Error when setting 'filetype' in help file again.
Solution: Deal with text property type already existing. (closes #10409)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/import/dist/vimhelp.vim | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/import/dist/vimhelp.vim b/runtime/import/dist/vimhelp.vim index 1f587251b9..00cc79cfdb 100644 --- a/runtime/import/dist/vimhelp.vim +++ b/runtime/import/dist/vimhelp.vim @@ -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 |