view runtime/syntax/autodoc.vim @ 34379:37b4c89ba420 v9.1.0116

patch 9.1.0116: win_split_ins may not check available room Commit: https://github.com/vim/vim/commit/0fd44a5ad81ade342cb54d8984965bdedd2272c8 Author: Sean Dewar <6256228+seandewar@users.noreply.github.com> Date: Tue Feb 20 20:28:15 2024 +0100 patch 9.1.0116: win_split_ins may not check available room Problem: win_split_ins has no check for E36 when moving an existing window Solution: check for room and fix the issues in f_win_splitmove() (Sean Dewar) win_split_ins has no check for E36 when moving an existing window, allowing for layouts with many overlapping zero-sized windows to be created (which may also cause drawing issues with tablines and such). f_win_splitmove also has some bugs. So check for room and fix the issues in f_win_splitmove. Handle failure in the two relevant win_split_ins callers by restoring the original layout, and factor the common logic into win_splitmove. Don't check for room when opening an autocommand window, as it's a temporary window that's rarely interacted with or drawn anyhow, and is rather important for some autocommands. Issues fixed in f_win_splitmove: - Error if splitting is disallowed. - Fix heap-use-after-frees if autocommands fired from switching to "targetwin" close "wp" or "oldwin". - Fix splitting the wrong window if autocommands fired from switching to "targetwin" switch to a different window. - Ensure -1 is returned for all errors. Also handle allocation failure a bit earlier in make_snapshot (callers, except win_splitmove, don't really care if a snapshot can't be made, so just ignore the return value). Note: Test_smoothscroll_in_zero_width_window failed after these changes with E36, as it was using the previous behaviour to create a zero-width window. I've fixed the test such that it fails with UBSAN as expected when v9.0.1367 is reverted (and simplified it too). related: #14042 Signed-off-by: Sean Dewar <6256228+seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 20 Feb 2024 22:30:04 +0100
parents 371ceeebbdaa
children
line wrap: on
line source

" Vim syntax file
" Language:	Autodoc
" Maintainer:	Stephen R. van den Berg <srb@cuci.nl>
" Last Change:	2018 Jan 23
" Version:	2.9
" Remark:       Included by pike.vim, cmod.vim and optionally c.vim
" Remark:       In order to make c.vim use it, set: c_autodoc

" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

syn case match

" A bunch of useful autodoc keywords
syn keyword autodocStatement contained appears belongs global
syn keyword autodocStatement contained decl directive inherit
syn keyword autodocStatement contained deprecated obsolete bugs
syn keyword autodocStatement contained copyright example fixme note param returns
syn keyword autodocStatement contained seealso thanks throws constant
syn keyword autodocStatement contained member index elem
syn keyword autodocStatement contained value type item

syn keyword autodocRegion contained enum mapping code multiset array
syn keyword autodocRegion contained int string section mixed ol ul dl
syn keyword autodocRegion contained class module namespace
syn keyword autodocRegion contained endenum endmapping endcode endmultiset
syn keyword autodocRegion contained endarray endint endstring endsection
syn keyword autodocRegion contained endmixed endol endul enddl
syn keyword autodocRegion contained endclass endmodule endnamespace

syn keyword autodocIgnore contained ignore endignore

syn keyword autodocStatAcc contained b i u tt url pre sub sup
syn keyword autodocStatAcc contained ref rfc xml dl expr image

syn keyword	autodocTodo		contained TODO FIXME XXX

syn match autodocLineStart	display "\(//\|/\?\*\)\@2<=!"
syn match autodocWords "[^!@{}[\]]\+" display contains=@Spell

syn match autodocLink "@\[[^[\]]\+]"hs=s+2,he=e-1 display contains=autodocLead
syn match autodocAtStmt "@[a-z]\+\%(\s\|$\)\@="hs=s+1 display contains=autodocStatement,autodocIgnore,autodocLead,autodocRegion

" Due to limitations of the matching algorithm, we cannot highlight
" nested autodocNStmtAcc structures correctly
syn region autodocNStmtAcc start="@[a-z]\+{" end="@}" contains=autodocStatAcc,autodocLead keepend

syn match autodocUrl contained display ".\+"
syn region autodocAtUrlAcc start="{"ms=s+1 end="@}"he=e-1,me=e-2 contained display contains=autodocUrl,autodocLead keepend
syn region autodocNUrlAcc start="@url{" end="@}" contains=autodocStatAcc,autodocAtUrlAcc,autodocLead transparent

syn match autodocSpecial "@@" display
syn match autodocLead "@" display contained

"when wanted, highlight trailing white space
if exists("c_space_errors")
  if !exists("c_no_trail_space_error")
    syn match	autodocSpaceError	display excludenl "\s\+$"
  endif
  if !exists("c_no_tab_space_error")
    syn match	autodocSpaceError	display " \+\t"me=e-1
  endif
endif

if exists("c_minlines")
  let b:c_minlines = c_minlines
else
  if !exists("c_no_if0")
    let b:c_minlines = 50	" #if 0 constructs can be long
  else
    let b:c_minlines = 15	" mostly for () constructs
  endif
endif
exec "syn sync ccomment autodocComment minlines=" . b:c_minlines

" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link autodocStatement	Statement
hi def link autodocStatAcc	Statement
hi def link autodocRegion	Structure
hi def link autodocAtStmt	Error
hi def link autodocNStmtAcc	Identifier
hi def link autodocLink		Type
hi def link autodocTodo		Todo
hi def link autodocSpaceError	Error
hi def link autodocLineStart	SpecialComment
hi def link autodocSpecial	SpecialChar
hi def link autodocUrl		Underlined
hi def link autodocLead		Statement
hi def link autodocIgnore	Delimiter

let b:current_syntax = "autodoc"

let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8