Mercurial > vim
comparison runtime/import/dist/vimhelp.vim @ 28837:64c3323117b4 v8.2.4942
patch 8.2.4942: error when setting 'filetype' in help file again
Commit: https://github.com/vim/vim/commit/de216732d45caa87e6f08f4319aa71e805a89a0e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 12 17:24:49 2022 +0100
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 https://github.com/vim/vim/issues/10409)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 12 May 2022 18:30:05 +0200 |
parents | db38dab0e525 |
children | c58baa6d6dda |
comparison
equal
deleted
inserted
replaced
28836:60e7b3a726e7 | 28837:64c3323117b4 |
---|---|
7 var buf: number = bufnr('%') | 7 var buf: number = bufnr('%') |
8 var lnum: number = search('\*highlight-groups\*', 'cn') | 8 var lnum: number = search('\*highlight-groups\*', 'cn') |
9 while getline(lnum) !~ '===' && lnum < line('$') | 9 while getline(lnum) !~ '===' && lnum < line('$') |
10 var word: string = getline(lnum)->matchstr('^\w\+\ze\t') | 10 var word: string = getline(lnum)->matchstr('^\w\+\ze\t') |
11 if word->hlexists() | 11 if word->hlexists() |
12 prop_type_add('help-hl-' .. word, { | 12 var name = 'help-hl-' .. word |
13 bufnr: buf, | 13 if prop_type_list({bufnr: buf})->match(name) == -1 |
14 highlight: word, | 14 prop_type_add('help-hl-' .. word, { |
15 combine: false, | 15 bufnr: buf, |
16 }) | 16 highlight: word, |
17 combine: false, | |
18 }) | |
19 else | |
20 # was called before, delete existing properties | |
21 prop_remove({type: name, bufnr: buf}) | |
22 endif | |
17 prop_add(lnum, 1, {length: word->strlen(), type: 'help-hl-' .. word}) | 23 prop_add(lnum, 1, {length: word->strlen(), type: 'help-hl-' .. word}) |
18 endif | 24 endif |
19 ++lnum | 25 ++lnum |
20 endwhile | 26 endwhile |
21 enddef | 27 enddef |