Mercurial > vim
view runtime/syntax/fan.vim @ 34536:ad6cd802579d v9.1.0170
patch 9.1.0170: Re-allow curwin == prevwin, but document it instead
Commit: https://github.com/vim/vim/commit/d64801e913314d2e19dbb38f60e6d285238debff
Author: Sean Dewar <6256228+seandewar@users.noreply.github.com>
Date: Tue Mar 12 20:46:12 2024 +0100
patch 9.1.0170: Re-allow curwin == prevwin, but document it instead
Problem: more places exist where curwin == prevwin, and it may even be
expected in some cases.
Solution: revert v9.1.0001, but document that it's possible instead.
(Sean Dewar)
I've had a change of heart for the following reasons:
- A quick 'n dirty [GitHub code
search](https://github.com/search?q=%2F%28winnr%5C%28%5C%29%5Cs*%3D%3D%5Cs*winnr%5C%28%5B%27%22%5D%23%5B%27%22%5D%5C%29%7Cwinnr%5C%28%5B%27%22%5D%23%5B%27%22%5D%5C%29%5Cs*%3D%3D%5Cs*winnr%5C%28%5C%29%29%2F&type=code)
reveals some cases where it's expected in the wild.
Particularly, it made me aware `winnr() == winnr('#')` is possible when curwin
is changed temporarily during the evaluation of a &statusline expression item
(`%{...}`), and is used to show something different on the statusline
belonging to the previous window; that behaviour wasn't changed in v9.1.0001,
but it means curwin == prevwin makes sense in some cases.
- The definition and call sites of back_to_prevwin imply some expectation that
prevwin == wp (== curwin) is possible, as it's used to skip entering the
prevwin in that case.
- Prior to v9.1.0001, `:wincmd p` would not beep in the case that was patched in
v9.1.0001, but now does. That resulted in #14047 being opened, as it affected
the CtrlP plugin.
I find it odd that `:wincmd p` had cases where it wouldn't beep despite doing
nothing, but it may be preferable to keep things that way (or instead also
beep if curwin == prevwin, if that's preferred).
- After more digging, I found cases in win_free_mem, enter_tabpage,
aucmd_restbuf and qf_open_new_cwindow where curwin == prevwin is possible
(many of them from autocommands). Others probably exist too, especially in
places where curwin is changed temporarily.
fixes: #14047
closes: #14186
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, 12 Mar 2024 21:00:11 +0100 |
parents | 03a5f2897db3 |
children |
line wrap: on
line source
" Vim syntax file " Language: Fantom " Maintainer: Kamil Toman <kamil.toman@gmail.com> " Last Change: 2010 May 27 " Based on Java syntax file by Claudio Fleiner <claudio@fleiner.com> " Quit when a syntax file was already loaded if exists("b:current_syntax") finish endif " keyword definitions syn keyword fanExternal using native syn keyword fanError goto void serializable volatile syn keyword fanConditional if else switch syn keyword fanRepeat do while for foreach each syn keyword fanBoolean true false syn keyword fanConstant null syn keyword fanTypedef this super syn keyword fanOperator new is isnot as syn keyword fanLongOperator plus minus mult div mod get set slice lshift rshift and or xor inverse negate increment decrement equals compare syn keyword fanType Void Bool Int Float Decimal Str Duration Uri Type Range List Map Obj syn keyword fanStatement return syn keyword fanStorageClass static const final syn keyword fanSlot virtual override once syn keyword fanField readonly syn keyword fanExceptions throw try catch finally syn keyword fanAssert assert syn keyword fanTypedef class enum mixin syn match fanFacet "@[_a-zA-Z][_a-zA-Z0-9_]*\>" syn keyword fanBranch break continue syn keyword fanScopeDecl public internal protected private abstract if exists("fan_space_errors") if !exists("fan_no_trail_space_error") syn match fanSpaceError "\s\+$" endif if !exists("fan_no_tab_space_error") syn match fanSpaceError " \+\t"me=e-1 endif endif syn region fanLabelRegion transparent matchgroup=fanLabel start="\<case\>" matchgroup=NONE end=":" contains=fanNumber,fanCharacter syn keyword fanLabel default syn keyword fanLabel case " The following cluster contains all fan groups except the contained ones syn cluster fanTop add=fanExternal,fanError,fanConditional,fanRepeat,fanBoolean,fanConstant,fanTypedef,fanOperator,fanLongOperator,fanType,fanType,fanStatement,fanStorageClass,fanSlot,fanField,fanExceptions,fanAssert,fanClassDecl,fanTypedef,fanFacet,fanBranch,fanScopeDecl,fanLabelRegion,fanLabel " Comments syn keyword fanTodo contained TODO FIXME XXX syn region fanComment start="/\*" end="\*/" contains=@fanCommentSpecial,fanTodo,fanComment,@Spell syn match fanCommentStar contained "^\s*\*[^/]"me=e-1 syn match fanCommentStar contained "^\s*\*$" syn match fanLineComment "//.*" contains=@fanCommentSpecial2,fanTodo,@Spell syn match fanDocComment "\*\*.*" contains=@fanCommentSpecial2,fanTodo,@Spell hi def link fanCommentString fanString hi def link fanComment2String fanString hi def link fanCommentCharacter fanCharacter syn cluster fanTop add=fanComment,fanLineComment,fanDocComment " match the special comment /**/ syn match fanComment "/\*\*/" " Strings and constants syn match fanSpecialError contained "\\." syn match fanSpecialCharError contained "[^']" syn match fanSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\|\$\)" syn match fanStringSubst contained "\$[A-Za-z][A-Za-z_.]*" syn match fanStringSubst contained "\${[^}]*}" syn region fanString start=+"+ end=+"+ contains=fanSpecialChar,fanSpecialError,fanStringSubst,@Spell syn region fanTripleString start=+"""+ end=+"""+ contains=fanSpecialChar,fanSpecialError,fanStringSubst,@Spell syn region fanDSL start=+<|+ end=+|>+ syn match fanUri "`[^`]*`" syn match fanCharacter "'[^']*'" contains=fanSpecialChar,fanSpecialCharError syn match fanCharacter "'\\''" contains=fanSpecialChar syn match fanCharacter "'[^\\]'" syn match fanNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" syn match fanNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" syn match fanNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" syn match fanNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" syn cluster fanTop add=fanString,fanCharacter,fanNumber,fanSpecial,fanStringError " The default highlighting. hi def link fanBranch Conditional hi def link fanLabel Label hi def link fanUserLabel Label hi def link fanConditional Conditional hi def link fanRepeat Repeat hi def link fanExceptions Exception hi def link fanAssert Statement hi def link fanStorageClass StorageClass hi def link fanSlot StorageClass hi def link fanField StorageClass hi def link fanScopeDecl StorageClass hi def link fanBoolean Boolean hi def link fanSpecial Special hi def link fanSpecialError Error hi def link fanSpecialCharError Error hi def link fanTripleString String hi def link fanString String hi def link fanDSL String hi def link fanCharacter String hi def link fanStringSubst Identifier hi def link fanUri SpecialChar hi def link fanSpecialChar SpecialChar hi def link fanNumber Number hi def link fanError Error hi def link fanStringError Error hi def link fanStatement Statement hi def link fanOperator Operator hi def link fanLongOperator Operator hi def link fanComment Comment hi def link fanDocComment Comment hi def link fanLineComment Comment hi def link fanConstant Constant hi def link fanTypedef Typedef hi def link fanTodo Todo hi def link fanFacet PreProc hi def link fanCommentTitle SpecialComment hi def link fanCommentStar SpecialComment hi def link fanType Identifier hi def link fanExternal Include hi def link fanSpaceError Error let b:current_syntax = "fan" " vim: ts=8