view runtime/import/dist/vimhelp.vim @ 28950:44481ae7c7ce v8.2.4997

patch 8.2.4997: Python: changing hidden buffer can cause display mess up Commit: https://github.com/vim/vim/commit/37233f6022b3ed16985a91d22752b3ca162e21d0 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 22 12:23:48 2022 +0100 patch 8.2.4997: Python: changing hidden buffer can cause display mess up Problem: Python: changing hidden buffer can cause the display to be messed up. Solution: Do not mark changed lines when using another buffer. (Paul Ollis, closes #10437, closes #7972)
author Bram Moolenaar <Bram@vim.org>
date Sun, 22 May 2022 13:30:03 +0200
parents 64c3323117b4
children c58baa6d6dda
line wrap: on
line source

vim9script

# Extra functionality for displaying Vim help .

# Called when editing the doc/syntax.txt file
export def HighlightGroups()
  var buf: number = bufnr('%')
  var lnum: number = search('\*highlight-groups\*', 'cn')
  while getline(lnum) !~ '===' && lnum < line('$')
    var word: string = getline(lnum)->matchstr('^\w\+\ze\t')
    if word->hlexists()
      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
  endwhile
enddef