Mercurial > vim
view runtime/syntax/jproperties.vim @ 34194:a522c6c0127b v9.1.0047
patch 9.1.0047: issues with temp curwin/buf while cmdwin is open
Commit: https://github.com/vim/vim/commit/988f74311c26ea9917e84fbae608de226dba7e5f
Author: Sean Dewar <seandewar@users.noreply.github.com>
Date: Wed Aug 16 14:17:36 2023 +0100
patch 9.1.0047: issues with temp curwin/buf while cmdwin is open
Problem: Things that temporarily change/restore curwin/buf (e.g:
win_execute, some autocmds) may break assumptions that
curwin/buf is the cmdwin when "cmdwin_type != 0", causing
issues.
Solution: Expose the cmdwin's real win/buf and check that instead. Also
try to ensure these variables are NULL if "cmdwin_type == 0",
allowing them to be used directly in most cases without
checking cmdwin_type. (Sean Dewar)
Alternatively, we could ban win_execute in the cmdwin and audit all places that
temporarily change/restore curwin/buf, but I didn't notice any problems arising
from allowing this (standard cmdwin restrictions still apply, so things that may
actually break the cmdwin are still forbidden).
closes: #12819
Signed-off-by: Sean Dewar <seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 23 Jan 2024 23:00:04 +0100 |
parents | 46763b01cd9a |
children |
line wrap: on
line source
" Vim syntax file " Language: Java Properties resource file (*.properties[_*]) " Maintainer: Simon Baldwin <simonb@sco.com> " Last change: 26th Mar 2000 " ============================================================================= " Optional and tuning variables: " jproperties_lines " ----------------- " Set a value for the sync block that we use to find long continuation lines " in properties; the value is already large - if you have larger continuation " sets you may need to increase it further - if not, and you find editing is " slow, reduce the value of jproperties_lines. if !exists("jproperties_lines") let jproperties_lines = 256 endif " jproperties_strict_syntax " ------------------------- " Most properties files assign values with "id=value" or "id:value". But, " strictly, the Java properties parser also allows "id value", "id", and " even more bizarrely "=value", ":value", " value", and so on. These latter " ones, however, are rarely used, if ever, and handling them in the high- " lighting can obscure errors in the more normal forms. So, in practice " we take special efforts to pick out only "id=value" and "id:value" forms " by default. If you want strict compliance, set jproperties_strict_syntax " to non-zero (and good luck). if !exists("jproperties_strict_syntax") let jproperties_strict_syntax = 0 endif " jproperties_show_messages " ------------------------- " If this properties file contains messages for use with MessageFormat, " setting a non-zero value will highlight them. Messages are of the form " "{...}". Highlighting doesn't go to the pains of picking apart what is " in the format itself - just the basics for now. if !exists("jproperties_show_messages") let jproperties_show_messages = 0 endif " ============================================================================= " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif " switch case sensitivity off syn case ignore " set the block exec "syn sync lines=" . jproperties_lines " switch between 'normal' and 'strict' syntax if jproperties_strict_syntax != 0 " an assignment is pretty much any non-empty line at this point, " trying to not think about continuation lines syn match jpropertiesAssignment "^\s*[^[:space:]]\+.*$" contains=jpropertiesIdentifier " an identifier is anything not a space character, pretty much; it's " followed by = or :, or space or tab. Or end-of-line. syn match jpropertiesIdentifier "[^=:[:space:]]*" contained nextgroup=jpropertiesDelimiter " treat the delimiter specially to get colours right syn match jpropertiesDelimiter "\s*[=:[:space:]]\s*" contained nextgroup=jpropertiesString " catch the bizarre case of no identifier; a special case of delimiter syn match jpropertiesEmptyIdentifier "^\s*[=:]\s*" nextgroup=jpropertiesString else " here an assignment is id=value or id:value, and we conveniently " ignore continuation lines for the present syn match jpropertiesAssignment "^\s*[^=:[:space:]]\+\s*[=:].*$" contains=jpropertiesIdentifier " an identifier is anything not a space character, pretty much; it's " always followed by = or :, and we find it in an assignment syn match jpropertiesIdentifier "[^=:[:space:]]\+" contained nextgroup=jpropertiesDelimiter " treat the delimiter specially to get colours right; this time the " delimiter must contain = or : syn match jpropertiesDelimiter "\s*[=:]\s*" contained nextgroup=jpropertiesString endif " a definition is all up to the last non-\-terminated line; strictly, Java " properties tend to ignore leading whitespace on all lines of a multi-line " definition, but we don't look for that here (because it's a major hassle) syn region jpropertiesString start="" skip="\\$" end="$" contained contains=jpropertiesSpecialChar,jpropertiesError,jpropertiesSpecial " {...} is a Java Message formatter - add a minimal recognition of these " if required if jproperties_show_messages != 0 syn match jpropertiesSpecial "{[^}]*}\{-1,\}" contained syn match jpropertiesSpecial "'{" contained syn match jpropertiesSpecial "''" contained endif " \uABCD are unicode special characters syn match jpropertiesSpecialChar "\\u\x\{1,4}" contained " ...and \u not followed by a hex digit is an error, though the properties " file parser won't issue an error on it, just set something wacky like zero syn match jpropertiesError "\\u\X\{1,4}" contained syn match jpropertiesError "\\u$"me=e-1 contained " other things of note are the \t,r,n,\, and the \ preceding line end syn match jpropertiesSpecial "\\[trn\\]" contained syn match jpropertiesSpecial "\\\s" contained syn match jpropertiesSpecial "\\$" contained " comments begin with # or !, and persist to end of line; put here since " they may have been caught by patterns above us syn match jpropertiesComment "^\s*[#!].*$" contains=jpropertiesTODO syn keyword jpropertiesTodo TODO FIXME XXX contained " Define the default highlighting. " Only when an item doesn't have highlighting yet hi def link jpropertiesComment Comment hi def link jpropertiesTodo Todo hi def link jpropertiesIdentifier Identifier hi def link jpropertiesString String hi def link jpropertiesExtendString String hi def link jpropertiesCharacter Character hi def link jpropertiesSpecial Special hi def link jpropertiesSpecialChar SpecialChar hi def link jpropertiesError Error let b:current_syntax = "jproperties" " vim:ts=8