Merge remote-tracking branch 'vim/master'

This commit is contained in:
Yee Cheng Chin
2026-04-07 17:12:21 -07:00
51 changed files with 2817 additions and 571 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
*filetype.txt* For Vim version 9.2. Last change: 2026 Mar 24
*filetype.txt* For Vim version 9.2. Last change: 2026 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -652,6 +652,13 @@ One command, :DiffGitCached, is provided to show a diff of the current commit
in the preview window. It is equivalent to calling "git diff --cached" plus
any arguments given to the command.
The length of the first line of the commit message used for
syntax highlighting can be configured via `g:gitcommit_summary_length`.
The default is 50. Example: >
let g:gitcommit_summary_length = 70
GIT REBASE *ft-gitrebase-plugin*
The gitrebase filetype defines the following buffer-local commands, to help
+12 -1
View File
@@ -1,4 +1,4 @@
*gui.txt* For Vim version 9.2. Last change: 2026 Feb 14
*gui.txt* For Vim version 9.2. Last change: 2026 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1184,11 +1184,22 @@ For the Win32 GUI *E244* *E245*
NONANTIALIASED, CLEARTYPE and DEFAULT. Normally you would use
"qDEFAULT".
Some quality values are not supported in legacy OSs.
fXX - OpenType font feature. Specify a single feature as
tag=value, where tag is a 4-character OpenType feature
tag and value is the parameter (0 to disable, 1 or
higher to enable/select variant). Multiple features
can be specified by repeating the ":f" option.
This only takes effect when 'renderoptions' is set to use
DirectWrite (type:directx). Default features (calt, liga,
etc.) are preserved unless explicitly overridden.
Example: ":fss19=1:fcalt=0" enables Stylistic Set 19
and disables Contextual Alternates.
- A '_' can be used in the place of a space, so you don't need to use
backslashes to escape the spaces.
Examples: >
:set guifont=courier_new:h12:w5:b:cRUSSIAN
:set guifont=Andale_Mono:h7.5:w4.5
:set guifont=Cascadia_Code:h14:fss19=1:fcalt=1:fliga=1
See also |font-sizes|.
+2 -2
View File
@@ -1,4 +1,4 @@
*netbeans.txt* For Vim version 9.2. Last change: 2026 Feb 14
*netbeans.txt* For Vim version 9.2. Last change: 2026 Mar 07
VIM REFERENCE MANUAL by Gordon Prieur et al.
@@ -849,7 +849,7 @@ REJECT Not used.
These errors occur when a message violates the protocol:
*E627* *E628* *E629* *E632* *E633* *E634* *E635* *E636*
*E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646*
*E647* *E648* *E650* *E651* *E652*
*E647* *E648* *E649* *E650* *E651* *E652*
==============================================================================
+58 -1
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 9.2. Last change: 2026 Apr 06
*options.txt* For Vim version 9.2. Last change: 2026 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -7022,6 +7022,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
Defines a border and optional decorations for the popup menu in
completion. The value is a comma-separated list of keywords.
See |'pumopt'| for a consolidated alternative.
Border styles (at most one):
"single" use thin box-drawing characters
@@ -7057,6 +7058,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Determines the maximum number of items to show in the popup menu for
Insert mode completion. When zero as much space as available is used.
|ins-completion-menu|.
See |'pumopt'| for a consolidated alternative.
*'pummaxwidth'* *'pmw'*
'pummaxwidth' 'pmw' number (default 0)
@@ -7068,12 +7070,67 @@ A jump table for the options with a short description can be found at |Q_op|.
This option takes precedence over 'pumwidth'.
|ins-completion-menu|.
See |'pumopt'| for a consolidated alternative.
*'pumopt'*
'pumopt' string (default "")
global
Configures the popup menu used for Insert mode completion.
The value is a comma-separated list of key:value pairs and flags.
Keys with values:
border:{style} set a border style (at most one):
"single" thin box-drawing characters
"double" double-line box-drawing characters
"round" rounded corners
"ascii" ASCII characters (-, |, +)
"custom:X;X;X;X;X;X;X;X"
eight characters separated by
semicolons, in the order: top, right,
bottom, left, topleft, topright,
botright, botleft
height:{n} maximum number of items to show (default 0,
meaning as much space as available)
width:{n} minimum width (default 15)
maxwidth:{n} maximum width (default 0, meaning no limit).
This takes precedence over width.
Truncated text is indicated by "trunc" value
of 'fillchars' option.
opacity:{n} opacity percentage 0-100 (default 100).
When less than 100, background content shows
through the popup menu.
Flags (no value):
margin adds one-cell spacing inside the left and
right border. Requires a border style.
shadow draws a shadow at the right and bottom edges.
Border styles using box-drawing characters ("single", "double",
"round") are only available when 'encoding' is "utf-8" and
'ambiwidth' is "single".
Highlight groups:
|hl-PmenuBorder| used for the border characters
|hl-PmenuShadow| used for the shadow
Note: When 'pumopt' is set, all values are reset to their defaults
first, then the specified keys are applied. Unspecified keys get
their default values.
Examples: >
:set pumopt=border:single
:set pumopt=border:double,margin,shadow
:set pumopt=height:10,width:20,opacity:80
:set pumopt=border:custom:─;│;─;│;┌;┐;┘;└,shadow
<
See also: |ins-completion-menu|.
*'pumwidth'* *'pw'*
'pumwidth' 'pw' number (default 15)
global
Determines the minimum width to use for the popup menu for Insert mode
completion. |ins-completion-menu|.
See |'pumopt'| for a consolidated alternative.
*'pythondll'*
'pythondll' string (default depends on the build)
+2 -1
View File
@@ -1,4 +1,4 @@
*quickref.txt* For Vim version 9.2. Last change: 2026 Mar 04
*quickref.txt* For Vim version 9.2. Last change: 2026 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -872,6 +872,7 @@ Short explanation of each option: *option-list*
'printoptions' 'popt' controls the format of :hardcopy output
'prompt' 'prompt' enable prompt in Ex mode
'pumheight' 'ph' maximum height of the popup menu
'pumopt' 'pumopt' additional options for the popup menu
'pumwidth' 'pw' minimum width of the popup menu
'pythondll' name of the Python 2 dynamic library
'pythonhome' name of the Python 2 home directory
+2
View File
@@ -909,6 +909,7 @@ $quote eval.txt /*$quote*
'pumborder' options.txt /*'pumborder'*
'pumheight' options.txt /*'pumheight'*
'pummaxwidth' options.txt /*'pummaxwidth'*
'pumopt' options.txt /*'pumopt'*
'pumwidth' options.txt /*'pumwidth'*
'pvh' options.txt /*'pvh'*
'pvp' options.txt /*'pvp'*
@@ -5351,6 +5352,7 @@ E645 netbeans.txt /*E645*
E646 netbeans.txt /*E646*
E647 netbeans.txt /*E647*
E648 netbeans.txt /*E648*
E649 netbeans.txt /*E649*
E65 pattern.txt /*E65*
E650 netbeans.txt /*E650*
E651 netbeans.txt /*E651*
+4 -2
View File
@@ -1,4 +1,4 @@
*textprop.txt* For Vim version 9.2. Last change: 2026 Apr 06
*textprop.txt* For Vim version 9.2. Last change: 2026 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -511,7 +511,9 @@ will move accordingly.
When text is deleted and a text property no longer includes any text, it is
deleted. However, a text property that was defined as zero-width will remain,
unless the whole line is deleted.
unless the whole line is deleted. When lines are joined by a multi-line
substitute command, virtual text properties on the deleted lines are moved to
the resulting joined line.
*E275*
When a buffer is unloaded, all the text properties are gone. There is no way
to store the properties in a file. You can only re-create them. When a
+9 -2
View File
@@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.2. Last change: 2026 Mar 25
*version9.txt* For Vim version 9.2. Last change: 2026 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52614,17 +52614,23 @@ Other ~
- |system()| and |systemlist()| functions accept a list as first argument,
bypassing the shell completely.
Platform specific ~
-----------------
- support OpenType font features in 'guifont' for DirectWrite (Win32)
xxd ~
---
Add "-t" option to append a terminating NUL byte to C include output (-i).
*changed-9.3*
Changed~
Changed ~
-------
- Support for NeXTStep was dropped with patch v9.2.0122
- |json_decode()| is stricter: keywords must be lowercase, lone surrogates are
now invalid
- |js_decode()| rejects lone surrogates
- virtual text properties on lines deleted by a multi-line substitute
are moved to the resulting joined line instead of being dropped.
*added-9.3*
Added ~
@@ -52641,6 +52647,7 @@ Autocommands: ~
Options: ~
'pumopt' Additional options for the popup menu
'statuslineopt' Extra window-local options for the 'statusline', to
configure the height.
't_BS' Begin synchronized update.
+3 -1
View File
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2026 Mar 11
" Last Change: 2026 Apr 07
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
@@ -932,6 +932,8 @@ if has("insert_expand")
call <SID>OptionG("pmw", &pmw)
call <SID>AddOption("pumborder", gettext("popup border style"))
call <SID>OptionG("pb", &pb)
call <SID>AddOption("pumopt", gettext("additional options for the popup menu"))
call <SID>OptionG("pumopt", &pumopt)
call <SID>AddOption("completefunc", gettext("user defined function for Insert mode completion"))
call append("$", "\t" .. s:local_to_buffer)
call <SID>OptionL("cfu")
+5 -4
View File
@@ -6,6 +6,7 @@
" Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net>
" Last Change: 2022 Jul 25
" 2025 Oct 13 by Vim project: update multiline function syntax #18565
" 2026 Apr 07 by Vim project: update syntax script #19931
"
" This file is licensed under the MIT license, see COPYING.MIT in
" this source distribution for the terms.
@@ -62,14 +63,14 @@ syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.+]\+\
syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq
" Includes and requires
syn keyword bbInclude inherit include require contained
syn keyword bbInclude inherit inherit_defer include include_all require contained
syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref
syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest
syn match bbIncludeLine "^\(inherit\|inherit_defer\|include\|include_all\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest
" Add taks and similar
syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained
syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS addpylib contained
syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement
syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\|addpylib\)\s\+" contains=bbStatement nextgroup=bbStatementRest
" OE Important Functions
syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained
+9 -9
View File
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" Last Change: 2026 Mar 13
" Last Change: 2026 Apr 07
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -69,10 +69,10 @@ syn keyword vimOption contained co columns com comments cms commentstring cp com
syn keyword vimOption contained efm errorformat ek esckeys ei eventignore eiw eventignorewin et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase ft filetype fcs fillchars ffu findfunc fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine mfd maxfuncdepth skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained mmd maxmapdepth mm maxmem mmp maxmempattern mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc ost osctimeoutlen pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset pmbfn printmbfont skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained popt printoptions prompt pb pumborder ph pumheight pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname sbr showbreak skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline stlo statuslineopt su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors trz termresize skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained tsy termsync twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys wcr wincolor skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight whl winhighlight wmh winminheight wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained popt printoptions prompt pb pumborder ph pumheight pmw pummaxwidth pumopt pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess sn shortname skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained sbr showbreak sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline stlo statuslineopt su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained trz termresize tsy termsync twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode wop wildoptions wak winaltkeys skipwhite nextgroup=vimSetEqual,vimSetMod
syn keyword vimOption contained wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight whl winhighlight wmh winminheight wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes skipwhite nextgroup=vimSetEqual,vimSetMod
" vimOptions: These are the turn-off setting variants {{{2
" GEN_SYN_VIM: vimOption turn-off, START_STR='syn keyword vimOption contained', END_STR=''
@@ -108,10 +108,10 @@ syn keyword vimOptionVarName contained co columns com comments cms commentstring
syn keyword vimOptionVarName contained efm errorformat ek esckeys ei eventignore eiw eventignorewin et expandtab ex exrc fenc fileencoding fencs fileencodings ff fileformat ffs fileformats fic fileignorecase ft filetype fcs fillchars ffu findfunc fixeol fixendofline fcl foldclose fdc foldcolumn fen foldenable fde foldexpr fdi foldignore fdl foldlevel fdls foldlevelstart fmr foldmarker fdm foldmethod fml foldminlines fdn foldnestmax fdo foldopen fdt foldtext fex formatexpr flp formatlistpat fo formatoptions fp formatprg fs fsync gd gdefault gfm grepformat gp grepprg gcr guicursor gfn guifont gfs guifontset gfw guifontwide ghr guiheadroom gli guiligatures go guioptions guipty gtl guitablabel gtt guitabtooltip hf helpfile hh helpheight hlg helplang hid hidden hl highlight
syn keyword vimOptionVarName contained hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey imc imcmdline imd imdisable imi iminsert ims imsearch imsf imstatusfunc imst imstyle inc include inex includeexpr is incsearch inde indentexpr indk indentkeys inf infercase im insertmode isf isfname isi isident isk iskeyword isp isprint js joinspaces jop jumpoptions key kmp keymap km keymodel kpc keyprotocol kp keywordprg lmap langmap lm langmenu lnr langnoremap lrm langremap ls laststatus lz lazyredraw lhi lhistory lbr linebreak lines lsp linespace lisp lop lispoptions lw lispwords list lcs listchars lpl loadplugins luadll magic mef makeef menc makeencoding mp makeprg mps matchpairs mat matchtime mco maxcombine
syn keyword vimOptionVarName contained mfd maxfuncdepth mmd maxmapdepth mm maxmem mmp maxmempattern mmt maxmemtot msc maxsearchcount mis menuitems mopt messagesopt msm mkspellmem ml modeline mle modelineexpr mls modelines ma modifiable mod modified more mouse mousef mousefocus mh mousehide mousem mousemodel mousemev mousemoveevent mouses mouseshape mouset mousetime mzq mzquantum mzschemedll mzschemegcdll nf nrformats nu number nuw numberwidth ofu omnifunc odev opendevice opfunc operatorfunc ost osctimeoutlen pp packpath para paragraphs paste pt pastetoggle pex patchexpr pm patchmode pa path perldll pi preserveindent pvh previewheight pvp previewpopup pvw previewwindow pdev printdevice penc printencoding pexpr printexpr pfn printfont pheader printheader pmbcs printmbcharset
syn keyword vimOptionVarName contained pmbfn printmbfont popt printoptions prompt pb pumborder ph pumheight pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth shm shortmess
syn keyword vimOptionVarName contained sn shortname sbr showbreak sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline stlo statuslineopt su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding
syn keyword vimOptionVarName contained tgc termguicolors trz termresize tsy termsync twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu wim wildmode
syn keyword vimOptionVarName contained wop wildoptions wak winaltkeys wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight whl winhighlight wmh winminheight wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes
syn keyword vimOptionVarName contained pmbfn printmbfont popt printoptions prompt pb pumborder ph pumheight pmw pummaxwidth pumopt pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape ro readonly rdt redrawtime re regexpengine rnu relativenumber remap rop renderoptions report rs restorescreen ri revins rl rightleft rlc rightleftcmd rubydll ru ruler ruf rulerformat rtp runtimepath scr scroll scb scrollbind scf scrollfocus sj scrolljump so scrolloff sbo scrollopt sect sections secure sel selection slm selectmode ssop sessionoptions sh shell shcf shellcmdflag sp shellpipe shq shellquote srr shellredir ssl shellslash stmp shelltemp st shelltype sxe shellxescape sxq shellxquote sr shiftround sw shiftwidth
syn keyword vimOptionVarName contained shm shortmess sn shortname sbr showbreak sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline stpl showtabpanel ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab sms smoothscroll sts softtabstop spell spc spellcapcheck spf spellfile spl spelllang spo spelloptions sps spellsuggest sb splitbelow spk splitkeep spr splitright sol startofline stl statusline stlo statuslineopt su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax tpl tabpanel tplo tabpanelopt ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi
syn keyword vimOptionVarName contained tenc termencoding tgc termguicolors trz termresize tsy termsync twk termwinkey twsl termwinscroll tws termwinsize twt termwintype terse ta textauto tx textmode tw textwidth tsr thesaurus tsrfu thesaurusfunc top tildeop to timeout tm timeoutlen title titlelen titleold titlestring tb toolbar tbis toolbariconsize ttimeout ttm ttimeoutlen tbi ttybuiltin tf ttyfast ttym ttymouse tsl ttyscroll tty ttytype udir undodir udf undofile ul undolevels ur undoreload uc updatecount ut updatetime vsts varsofttabstop vts vartabstop vbs verbose vfile verbosefile vdir viewdir vop viewoptions vi viminfo vif viminfofile ve virtualedit vb visualbell warn wiv weirdinvert ww whichwrap wc wildchar wcm wildcharm wig wildignore wic wildignorecase wmnu wildmenu
syn keyword vimOptionVarName contained wim wildmode wop wildoptions wak winaltkeys wcr wincolor wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight whl winhighlight wmh winminheight wmw winminwidth winptydll wiw winwidth wse wlseat wst wlsteal wtm wltimeoutlen wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes
" GEN_SYN_VIM: vimOption term output code variable, START_STR='syn keyword vimOptionVarName contained', END_STR=''
syn keyword vimOptionVarName contained t_AB t_AF t_AU t_AL t_al t_bc t_BE t_BD t_cd t_ce t_Ce t_CF t_cl t_cm t_Co t_CS t_Cs t_cs t_CV t_da t_db t_DL t_dl t_ds t_Ds t_EC t_EI t_fs t_fd t_fe t_GP t_IE t_IS t_ke t_ks t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RF t_RB t_RC t_RI t_Ri t_RK t_RS t_RT t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_Si t_so t_SR t_sr t_ST t_Te t_te t_TE t_ti t_TI t_Ts t_ts t_u7 t_ue t_us t_Us t_ut t_vb t_ve t_vi t_VS t_vs t_WP t_WS t_XM t_xn t_xs t_ZH t_ZR t_8f t_8b t_8u t_xo t_BS t_ES
syn keyword vimOptionVarName contained t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ku
-3
View File
@@ -1119,9 +1119,6 @@ free_buffer_stuff(
#endif
#ifdef FEAT_NETBEANS_INTG
netbeans_file_killed(buf);
#endif
#ifdef FEAT_PROP_POPUP
ga_clear_strings(&buf->b_textprop_text);
#endif
map_clear_mode(buf, MAP_ALL_MODES, TRUE, FALSE); // clear local mappings
map_clear_mode(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs
+10 -1
View File
@@ -321,6 +321,9 @@ f_listener_add(typval_T *argvars, typval_T *rettv)
buf_T *buf = curbuf;
int unbuffered = 0;
if (check_secure())
return;
if (recursive)
{
emsg(_(e_cannot_add_listener_in_listener_callback));
@@ -386,6 +389,9 @@ f_listener_flush(typval_T *argvars, typval_T *rettv UNUSED)
{
buf_T *buf = curbuf;
if (check_secure())
return;
if (recursive)
return;
@@ -439,6 +445,9 @@ f_listener_remove(typval_T *argvars, typval_T *rettv)
int id;
buf_T *buf;
if (check_secure())
return;
if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
return;
@@ -2561,7 +2570,7 @@ truncate_line(int fixpos)
* Saves the lines for undo first if "undo" is TRUE.
*/
void
del_lines(long nlines, int undo)
del_lines(long nlines, int undo)
{
long n;
linenr_T first = curwin->w_cursor.lnum;
+19 -3
View File
@@ -1140,6 +1140,22 @@ init_chartabsize_arg(
cts->cts_text_props[text_prop_idxs[i]];
vim_free(text_prop_idxs);
}
// Convert tp_text_offset to tp_text pointer.
char_u *count_ptr = prop_start - PROP_COUNT_SIZE;
for (i = 0; i < count; ++i)
{
textprop_T *tp = &cts->cts_text_props[i];
if (tp->tp_id < 0 && tp->u.tp_text_offset > 0)
{
tp->u.tp_text = count_ptr + tp->u.tp_text_offset;
tp->tp_flags |= TP_FLAG_VTEXT_PTR;
}
else
tp->u.tp_text = NULL;
}
}
}
}
@@ -1294,7 +1310,7 @@ win_lbr_chartabsize(
int charlen = *s == NUL ? 1 : mb_ptr2len(s);
int i;
int col = (int)(s - line);
garray_T *gap = &wp->w_buffer->b_textprop_text;
// The "$" for 'list' mode will go between the EOL and
// the text prop, account for that.
@@ -1318,9 +1334,9 @@ win_lbr_chartabsize(
&& ((tp->tp_flags & TP_FLAG_ALIGN_ABOVE)
? col == 0
: s[0] == NUL && cts->cts_with_trailing)))
&& -tp->tp_id - 1 < gap->ga_len)
&& tp->u.tp_text != NULL)
{
char_u *p = ((char_u **)gap->ga_data)[-tp->tp_id - 1];
char_u *p = tp->u.tp_text;
if (p != NULL)
{
+24 -9
View File
@@ -685,8 +685,7 @@ text_prop_position(
int above = (tp->tp_flags & TP_FLAG_ALIGN_ABOVE);
int below = (tp->tp_flags & TP_FLAG_ALIGN_BELOW);
int wrap = tp->tp_col < MAXCOL || (tp->tp_flags & TP_FLAG_WRAP);
int padding = tp->tp_col == MAXCOL && tp->tp_len > 1
? tp->tp_len - 1 : 0;
int padding = tp->tp_col == MAXCOL ? tp->tp_padleft : 0;
int col_with_padding = scr_col + (below ? 0 : padding);
int room = wp->w_width - col_with_padding;
int before = room; // spaces before the text
@@ -1705,9 +1704,29 @@ win_line(
else
text_props = ALLOC_MULT(textprop_T, text_prop_count);
if (text_props != NULL)
{
mch_memmove(text_props, prop_start,
text_prop_count * sizeof(textprop_T));
// Convert tp_text_offset to tp_text pointer for virtual
// text properties. prop_start points into the memline
// after the prop_count field.
char_u *count_ptr = prop_start - PROP_COUNT_SIZE;
for (int i = 0; i < text_prop_count; ++i)
{
if (text_props[i].tp_id < 0
&& text_props[i].u.tp_text_offset > 0)
{
text_props[i].u.tp_text =
count_ptr + text_props[i].u.tp_text_offset;
text_props[i].tp_flags |= TP_FLAG_VTEXT_PTR;
}
else
text_props[i].u.tp_text = NULL;
}
}
// Allocate an array for the indexes.
if (text_prop_count <= WIN_LINE_TEXT_PROP_STACK_LEN)
text_prop_idxs = text_prop_idxs_buf;
@@ -2301,13 +2320,10 @@ win_line(
}
}
if (text_prop_id < 0 && used_tpi >= 0
&& -text_prop_id
<= wp->w_buffer->b_textprop_text.ga_len)
&& text_props[used_tpi].u.tp_text != NULL)
{
textprop_T *tp = &text_props[used_tpi];
char_u *p = ((char_u **)wp->w_buffer
->b_textprop_text.ga_data)[
-text_prop_id - 1];
char_u *p = tp->u.tp_text;
int above = (tp->tp_flags
& TP_FLAG_ALIGN_ABOVE);
int bail_out = FALSE;
@@ -2325,8 +2341,7 @@ win_line(
int wrap = tp->tp_col < MAXCOL
|| (tp->tp_flags & TP_FLAG_WRAP);
int padding = tp->tp_col == MAXCOL
&& tp->tp_len > 1
? tp->tp_len - 1 : 0;
? tp->tp_padleft : 0;
// Insert virtual text before the current
// character, or add after the end of the line.
+3 -3
View File
@@ -1669,7 +1669,8 @@ EXTERN char e_invalid_buffer_identifier_in_setdot[]
INIT(= N_("E647: Invalid buffer identifier in setDot"));
EXTERN char e_invalid_buffer_identifier_in_close[]
INIT(= N_("E648: Invalid buffer identifier in close"));
// E649 unused
EXTERN char e_invalid_identifier_in_defineannotype[]
INIT(= N_("E649: Invalid identifier name in defineAnnoType"));
EXTERN char e_invalid_buffer_identifier_in_defineannotype[]
INIT(= N_("E650: Invalid buffer identifier in defineAnnoType"));
EXTERN char e_invalid_buffer_identifier_in_addanno[]
@@ -3435,9 +3436,8 @@ EXTERN char e_internal_error_shortmess_too_long[]
#ifdef FEAT_EVAL
EXTERN char e_class_variable_str_not_found_in_class_str[]
INIT(= N_("E1337: Class variable \"%s\" not found in class \"%s\""));
// E1338 unused
#endif
// E1339 unused
// E1338 and E1339 unused
#ifdef FEAT_EVAL
EXTERN char e_argument_already_declared_in_class_str[]
INIT(= N_("E1340: Argument already declared in the class: %s"));
+27 -8
View File
@@ -4895,15 +4895,27 @@ ex_substitute(exarg_T *eap)
text_prop_count);
if (text_props != NULL)
{
int pi;
mch_memmove(text_props, prop_start,
text_prop_count * sizeof(textprop_T));
// After joining the text prop columns will
// increase.
for (pi = 0; pi < text_prop_count; ++pi)
text_props[pi].tp_col +=
regmatch.startpos[0].col + sublen - 1;
// Filter out virtual text and continuation
// properties from deleted lines, convert
// offsets to pointers, and adjust columns.
int wi = 0;
for (int pi = 0; pi < text_prop_count; ++pi)
{
// Skip virtual text and continuation
// properties from the deleted line.
if (text_props[pi].tp_id < 0
|| (text_props[pi].tp_flags
& TP_FLAG_CONT_PREV))
continue;
text_props[wi] = text_props[pi];
text_props[wi].tp_col +=
regmatch.startpos[0].col + sublen - 1;
text_props[wi].u.tp_text = NULL;
++wi;
}
text_prop_count = wi;
}
}
}
@@ -5142,7 +5154,14 @@ skip:
break;
for (i = 0; i < nmatch_tl; ++i)
ml_delete(lnum);
mark_adjust(lnum, lnum + nmatch_tl - 1,
if (copycol > 0)
mark_adjust(lnum, lnum + nmatch_tl - 1,
(long)MAXLNUM, -nmatch_tl);
else
// The entire last matched line was consumed,
// so the first line was effectively replaced
// by lines below.
mark_adjust(lnum - 1, lnum - 1,
(long)MAXLNUM, -nmatch_tl);
if (subflags.do_ask)
deleted_lines(lnum, nmatch_tl);
+17
View File
@@ -125,6 +125,23 @@ EXTERN int screen_zindex INIT(= 0);
EXTERN win_T *screen_opacity_popup INIT(= NULL);
#endif
// Pum opacity level (0 = fully transparent, 100 = fully opaque).
// Set via 'pumopt' opacity: key.
EXTERN long p_po INIT(= 100);
// Blend value for popup menu opacity (0 = off, 1-99 = blend level).
// Set during pum drawing when pum opacity is active.
EXTERN int screen_pum_blend INIT(= 0);
// Saved background screen content for pum opacity blending.
EXTERN sattr_T *pum_bg_attrs INIT(= NULL);
EXTERN schar_T *pum_bg_lines INIT(= NULL);
EXTERN u8char_T *pum_bg_linesUC INIT(= NULL);
EXTERN u8char_T *pum_bg_linesC[MAX_MCO];
EXTERN int pum_bg_top INIT(= 0);
EXTERN int pum_bg_bot INIT(= 0);
EXTERN int pum_bg_cols INIT(= 0);
EXTERN int screen_Rows INIT(= 0); // actual size of ScreenLines[]
EXTERN int screen_Columns INIT(= 0); // actual size of ScreenLines[]
+79 -1
View File
@@ -313,6 +313,9 @@ struct DWriteContext {
D2D1_TEXT_ANTIALIAS_MODE mTextAntialiasMode;
DWriteFontFeature mFontFeatures[DWRITE_MAX_FONT_FEATURES];
int mFontFeatureCount;
// METHODS
DWriteContext();
@@ -357,6 +360,8 @@ struct DWriteContext {
DWriteRenderingParams *GetRenderingParams(
DWriteRenderingParams *params);
void SetFontFeatures(const DWriteFontFeature *features, int count);
};
class AdjustedGlyphRun : public DWRITE_GLYPH_RUN
@@ -648,8 +653,10 @@ DWriteContext::DWriteContext() :
mFontStyle(DWRITE_FONT_STYLE_NORMAL),
mFontSize(0.0f),
mFontAscent(0.0f),
mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT)
mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT),
mFontFeatureCount(0)
{
ZeroMemory(mFontFeatures, sizeof(mFontFeatures));
HRESULT hr;
hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED,
@@ -1086,6 +1093,56 @@ DWriteContext::DrawText(const WCHAR *text, int len,
textLayout->SetFontWeight(mFontWeight, textRange);
textLayout->SetFontStyle(mFontStyle, textRange);
if (mFontFeatureCount > 0)
{
// Default OpenType features that DirectWrite normally enables.
// SetTypography() overrides all defaults, so we must
// re-add them here explicitly.
static const DWRITE_FONT_FEATURE defaultFeatures[] = {
{ DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES, 1 },
{ DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES, 1 },
{ DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES, 1 },
{ DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES, 1 },
{ DWRITE_FONT_FEATURE_TAG_KERNING, 1 },
};
static const int numDefaults = sizeof(defaultFeatures)
/ sizeof(defaultFeatures[0]);
IDWriteTypography *typography = NULL;
hr = mDWriteFactory->CreateTypography(&typography);
if (SUCCEEDED(hr))
{
// Add default features, skipping any that the user
// has explicitly specified (either + or -).
for (int d = 0; d < numDefaults; ++d)
{
int overridden = 0;
for (int u = 0; u < mFontFeatureCount; ++u)
{
if ((DWRITE_FONT_FEATURE_TAG)mFontFeatures[u].tag
== defaultFeatures[d].nameTag)
{
overridden = 1;
break;
}
}
if (!overridden)
typography->AddFontFeature(defaultFeatures[d]);
}
// Add user-specified features.
for (int i = 0; i < mFontFeatureCount; ++i)
{
DWRITE_FONT_FEATURE ff = {
(DWRITE_FONT_FEATURE_TAG)mFontFeatures[i].tag,
mFontFeatures[i].parameter
};
typography->AddFontFeature(ff);
}
textLayout->SetTypography(typography, textRange);
SafeRelease(&typography);
}
}
// Calculate baseline using font ascent from font metrics.
// Do NOT use GetLineMetrics() because it returns different values
// depending on text content (e.g., when CJK characters trigger
@@ -1413,3 +1470,24 @@ DWriteContext_GetRenderingParams(
else
return NULL;
}
void
DWriteContext::SetFontFeatures(
const DWriteFontFeature *features, int count)
{
if (count > DWRITE_MAX_FONT_FEATURES)
count = DWRITE_MAX_FONT_FEATURES;
mFontFeatureCount = count;
if (count > 0 && features != NULL)
memcpy(mFontFeatures, features, sizeof(DWriteFontFeature) * count);
}
void
DWriteContext_SetFontFeatures(
DWriteContext *ctx,
const DWriteFontFeature *features,
int count)
{
if (ctx != NULL)
ctx->SetFontFeatures(features, count);
}
+12
View File
@@ -51,6 +51,13 @@ typedef struct DWriteRenderingParams {
int textAntialiasMode;
} DWriteRenderingParams;
#define DWRITE_MAX_FONT_FEATURES 32
typedef struct DWriteFontFeature {
unsigned int tag; // OpenType feature tag (4 bytes)
unsigned int parameter; // Feature parameter (0 = disable, 1 = enable)
} DWriteFontFeature;
void DWrite_Init(void);
void DWrite_Final(void);
@@ -86,6 +93,11 @@ DWriteRenderingParams *DWriteContext_GetRenderingParams(
DWriteContext *ctx,
DWriteRenderingParams *params);
void DWriteContext_SetFontFeatures(
DWriteContext *ctx,
const DWriteFontFeature *features,
int count);
#ifdef __cplusplus
}
#endif
+54 -1
View File
@@ -145,7 +145,6 @@ gui_mch_set_rendering_options(char_u *s)
int dx_geom = 0;
int dx_renmode = 0;
int dx_taamode = 0;
// parse string as rendering options.
for (p = s; p != NULL && *p != NUL; )
{
@@ -3956,6 +3955,60 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
if (font == NOFONT)
return FAIL;
#if defined(FEAT_DIRECTX)
// Parse font features from guifont (e.g., ":fss19=1:fcalt=0:fliga=1").
{
DWriteFontFeature features[DWRITE_MAX_FONT_FEATURES];
int feat_count = 0;
char_u *fp;
if (font_name != NULL)
{
// Find each ":f" option in font_name.
for (fp = font_name; *fp != NUL; fp++)
{
if (*fp == ':' && *(fp + 1) == 'f')
{
char_u tag[5];
int ti = 0;
unsigned int param = 1;
fp += 2; // skip ":f"
while (*fp != NUL && *fp != '=' && *fp != ':'
&& ti < 4)
tag[ti++] = *fp++;
tag[ti] = NUL;
if (ti != 4)
continue; // invalid tag length
if (*fp == '=')
{
fp++;
param = (unsigned int)atoi((char *)fp);
while (*fp >= '0' && *fp <= '9')
fp++;
}
if (feat_count < DWRITE_MAX_FONT_FEATURES)
{
features[feat_count].tag =
((unsigned int)tag[0])
| ((unsigned int)tag[1] << 8)
| ((unsigned int)tag[2] << 16)
| ((unsigned int)tag[3] << 24);
features[feat_count].parameter = param;
feat_count++;
}
fp--; // adjust for loop increment
}
}
}
DWriteContext_SetFontFeatures(s_dwc, features, feat_count);
}
#endif
if (font_name == NULL)
font_name = (char_u *)"";
#ifdef FEAT_MBYTE_IME
+132
View File
@@ -3321,6 +3321,138 @@ hl_blend_attr(int char_attr, int popup_attr, int blend, int blend_fg UNUSED)
return get_attr_entry(&term_attr_table, &new_en);
}
/*
* Blend for pum opacity space cells: keep underlying fg, blend bg.
* This is different from hl_blend_attr(blend_fg=TRUE) where fg blends
* in the wrong direction for pum use.
*/
int
hl_pum_blend_attr(int char_attr, int popup_attr, int blend UNUSED)
{
attrentry_T *char_aep = NULL;
attrentry_T *popup_aep;
attrentry_T new_en;
#ifdef FEAT_GUI
if (gui.in_use)
{
if (char_attr > HL_ALL)
char_aep = syn_gui_attr2entry(char_attr);
if (char_aep != NULL)
new_en = *char_aep;
else
{
CLEAR_FIELD(new_en);
new_en.ae_u.gui.fg_color = INVALCOLOR;
new_en.ae_u.gui.bg_color = INVALCOLOR;
new_en.ae_u.gui.sp_color = INVALCOLOR;
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
if (popup_attr > HL_ALL)
{
popup_aep = syn_gui_attr2entry(popup_attr);
if (popup_aep != NULL)
{
// Blend fg: pum_bg toward underlying_fg.
// blend=0 (opaque): fg = pum_bg (text hidden)
// blend=100 (transparent): fg = underlying_fg (text visible)
if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
{
int base_fg = 0xFFFFFF;
if (char_aep != NULL
&& char_aep->ae_u.gui.fg_color != INVALCOLOR)
base_fg = char_aep->ae_u.gui.fg_color;
new_en.ae_u.gui.fg_color = blend_colors(
popup_aep->ae_u.gui.bg_color, base_fg, blend);
}
// Blend bg: popup bg toward underlying bg.
if (popup_aep->ae_u.gui.bg_color != INVALCOLOR)
{
guicolor_T underlying_bg = INVALCOLOR;
if (char_aep != NULL)
underlying_bg = char_aep->ae_u.gui.bg_color;
new_en.ae_u.gui.bg_color = blend_colors(
popup_aep->ae_u.gui.bg_color,
underlying_bg, blend);
}
}
}
return get_attr_entry(&gui_attr_table, &new_en);
}
#endif
if (IS_CTERM)
{
if (char_attr > HL_ALL)
char_aep = syn_cterm_attr2entry(char_attr);
if (char_aep != NULL)
new_en = *char_aep;
else
{
CLEAR_FIELD(new_en);
#ifdef FEAT_TERMGUICOLORS
new_en.ae_u.cterm.bg_rgb = INVALCOLOR;
new_en.ae_u.cterm.fg_rgb = INVALCOLOR;
new_en.ae_u.cterm.ul_rgb = INVALCOLOR;
#endif
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
if (popup_attr > HL_ALL)
{
popup_aep = syn_cterm_attr2entry(popup_attr);
if (popup_aep != NULL)
{
// Blend cterm fg: use popup bg (hides text when opaque)
if (popup_aep->ae_u.cterm.fg_color > 0)
new_en.ae_u.cterm.fg_color =
popup_aep->ae_u.cterm.fg_color;
// Use popup cterm bg.
if (popup_aep->ae_u.cterm.bg_color > 0)
new_en.ae_u.cterm.bg_color =
popup_aep->ae_u.cterm.bg_color;
#ifdef FEAT_TERMGUICOLORS
// Blend fg_rgb: pum_bg toward underlying_fg.
if (popup_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
{
int base_fg = 0xFFFFFF;
if (char_aep != NULL
&& char_aep->ae_u.cterm.fg_rgb != INVALCOLOR)
base_fg = char_aep->ae_u.cterm.fg_rgb;
new_en.ae_u.cterm.fg_rgb = blend_colors(
popup_aep->ae_u.cterm.bg_rgb, base_fg, blend);
}
// Blend bg_rgb.
if (popup_aep->ae_u.cterm.bg_rgb != INVALCOLOR)
{
guicolor_T underlying_bg = INVALCOLOR;
if (char_aep != NULL)
underlying_bg = char_aep->ae_u.cterm.bg_rgb;
new_en.ae_u.cterm.bg_rgb = blend_colors(
popup_aep->ae_u.cterm.bg_rgb,
underlying_bg, blend);
}
#endif
}
}
return get_attr_entry(&cterm_attr_table, &new_en);
}
// term mode
if (char_attr > HL_ALL)
char_aep = syn_term_attr2entry(char_attr);
if (char_aep != NULL)
new_en = *char_aep;
else
{
CLEAR_FIELD(new_en);
if (char_attr <= HL_ALL)
new_en.ae_attr = char_attr;
}
return get_attr_entry(&term_attr_table, &new_en);
}
#ifdef FEAT_GUI
attrentry_T *
syn_gui_attr2entry(int attr)
+54 -22
View File
@@ -2930,13 +2930,19 @@ add_text_props_for_append(
{
if (round == 2)
{
uint16_t pc;
if (new_prop_count == 0)
return; // nothing to do
new_len = *len + new_prop_count * sizeof(textprop_T);
new_len = *len + (int)PROP_COUNT_SIZE
+ new_prop_count * (int)sizeof(textprop_T);
new_line = alloc(new_len);
if (new_line == NULL)
return;
mch_memmove(new_line, *line, *len);
// Write prop_count header.
pc = (uint16_t)new_prop_count;
mch_memmove(new_line + *len, &pc, PROP_COUNT_SIZE);
new_prop_count = 0;
}
@@ -2954,8 +2960,10 @@ add_text_props_for_append(
prop.tp_flags |= TP_FLAG_CONT_PREV;
prop.tp_col = 1;
prop.tp_len = *len; // not exactly the right length
mch_memmove(new_line + *len + new_prop_count
* sizeof(textprop_T), &prop, sizeof(textprop_T));
prop.u.tp_text_offset = 0;
mch_memmove(new_line + *len + (int)PROP_COUNT_SIZE
+ new_prop_count * sizeof(textprop_T),
&prop, sizeof(textprop_T));
}
++new_prop_count;
}
@@ -3772,34 +3780,48 @@ adjust_text_props_for_delete(
textlen = STRLEN(text) + 1;
if ((long)textlen >= line_size)
{
// No properties on this line.
if (above)
internal_error("no text property above deleted line");
else
internal_error("no text property below deleted line");
return;
}
this_props_len = line_size - (int)textlen;
if ((long)textlen + (long)PROP_COUNT_SIZE > line_size)
{
internal_error("text property data too short");
return;
}
uint16_t pc;
mch_memmove(&pc, text + textlen, PROP_COUNT_SIZE);
this_props_len = pc * (int)sizeof(textprop_T);
}
found = FALSE;
for (done_this = 0; done_this < this_props_len;
done_this += sizeof(textprop_T))
{
int flag = above ? TP_FLAG_CONT_NEXT
: TP_FLAG_CONT_PREV;
textprop_T prop_this;
char_u *props_start = text + textlen + PROP_COUNT_SIZE;
mch_memmove(&prop_this, text + textlen + done_this,
sizeof(textprop_T));
if ((prop_this.tp_flags & flag)
&& prop_del.tp_id == prop_this.tp_id
&& prop_del.tp_type == prop_this.tp_type)
for (done_this = 0; done_this < this_props_len;
done_this += sizeof(textprop_T))
{
found = TRUE;
prop_this.tp_flags &= ~flag;
mch_memmove(text + textlen + done_this, &prop_this,
int flag = above ? TP_FLAG_CONT_NEXT
: TP_FLAG_CONT_PREV;
textprop_T prop_this;
mch_memmove(&prop_this, props_start + done_this,
sizeof(textprop_T));
break;
if ((prop_this.tp_flags & flag)
&& prop_del.tp_id == prop_this.tp_id
&& prop_del.tp_type == prop_this.tp_type)
{
found = TRUE;
prop_this.tp_flags &= ~flag;
mch_memmove(props_start + done_this, &prop_this,
sizeof(textprop_T));
break;
}
}
}
if (!found)
@@ -4003,13 +4025,23 @@ theend:
#ifdef FEAT_PROP_POPUP
if (textprop_save != NULL)
{
// textprop_save is [prop_count][textprop_T...][vtext...].
// Skip prop_count header and pass only the textprop_T part.
uint16_t pc;
char_u *props_data;
int props_bytes;
mch_memmove(&pc, textprop_save, PROP_COUNT_SIZE);
props_data = textprop_save + PROP_COUNT_SIZE;
props_bytes = pc * (int)sizeof(textprop_T);
// Adjust text properties in the line above and below.
if (lnum > 1)
adjust_text_props_for_delete(buf, lnum - 1, textprop_save,
(int)textprop_len, TRUE);
adjust_text_props_for_delete(buf, lnum - 1,
props_data, props_bytes, TRUE);
if (lnum <= buf->b_ml.ml_line_count)
adjust_text_props_for_delete(buf, lnum, textprop_save,
(int)textprop_len, FALSE);
adjust_text_props_for_delete(buf, lnum,
props_data, props_bytes, FALSE);
}
vim_free(textprop_save);
#endif
+48 -4
View File
@@ -40,6 +40,11 @@
#define GUARDEDOFFSET 1000000 // base for "guarded" sign id's
#define MAX_COLOR_LENGTH 32 // max length of color name in defineAnnoType
// Characters valid in a sign/highlight group name
#define VALID_CHARS (char_u *)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
#define VALID_SIGNNAME_CHARS VALID_CHARS "_"
#define VALID_COLOR_CHARS VALID_CHARS "#"
// The first implementation (working only with Netbeans) returned "1.1". The
// protocol implemented here also supports A-A-P.
static char *ExtEdProtocolVersion = "2.5";
@@ -77,6 +82,22 @@ static int dosetvisible = FALSE;
static int needupdate = 0;
static int inAtomic = 0;
/*
* Return TRUE if "str" contains only characters from "allowed".
* Used to validate NetBeans-supplied strings before interpolating them
* into Ex commands via coloncmd().
*/
static int
nb_is_safe_string(char_u *str, char_u *allowed)
{
if (str == NULL)
return FALSE;
for (char_u *p = str; *p != NUL; p++)
if (vim_strchr(allowed, *p) == NULL)
return FALSE;
return TRUE;
}
/*
* Callback invoked when the channel is closed.
*/
@@ -1949,6 +1970,15 @@ nb_do_cmd(
VIM_CLEAR(typeName);
parse_error = TRUE;
}
else if (!nb_is_safe_string(typeName, VALID_SIGNNAME_CHARS) ||
(*fg != NUL && !nb_is_safe_string(fg, VALID_COLOR_CHARS)) ||
(*bg != NUL && !nb_is_safe_string(bg, VALID_COLOR_CHARS)))
{
nbdebug((" invalid chars in typeName/fg/bg in defineAnnoType\n"));
emsg(_(e_invalid_identifier_in_defineannotype));
VIM_CLEAR(typeName);
parse_error = TRUE;
}
else if (typeName != NULL && tooltip != NULL && glyphFile != NULL)
addsigntype(buf, typeNum, typeName, tooltip, glyphFile, fg, bg);
@@ -2321,10 +2351,24 @@ special_keys(char_u *args)
if (strlen(tok) + i < KEYBUFLEN)
{
vim_strncpy((char_u *)&keybuf[i], (char_u *)tok, KEYBUFLEN - i - 1);
vim_snprintf(cmdbuf, sizeof(cmdbuf),
"<silent><%s> :nbkey %s<CR>", keybuf, keybuf);
do_map(MAPTYPE_MAP, (char_u *)cmdbuf, MODE_NORMAL, FALSE);
// Only allow alphanumeric and function-key name characters.
// Reject anything else to prevent map command injection.
int safe = TRUE;
for (char_u *tp = (char_u *)tok; *tp != NUL; tp++)
{
if (!ASCII_ISALNUM(*tp) && *tp != '-')
{
safe = FALSE;
break;
}
}
if (safe)
{
vim_strncpy((char_u *)&keybuf[i], (char_u *)tok, KEYBUFLEN - i - 1);
vim_snprintf(cmdbuf, sizeof(cmdbuf),
"<silent><%s> :nbkey %s<CR>", keybuf, keybuf);
do_map(MAPTYPE_MAP, (char_u *)cmdbuf, MODE_NORMAL, FALSE);
}
}
tok = strtok(NULL, " ");
}
+20 -15
View File
@@ -2172,10 +2172,6 @@ do_join(
int remove_comments = (use_formatoptions == TRUE)
&& has_format_option(FO_REMOVE_COMS);
int prev_was_comment;
#ifdef FEAT_PROP_POPUP
int propcount = 0; // number of props over all joined lines
int props_remaining;
#endif
if (save_undo && u_save((linenr_T)(curwin->w_cursor.lnum - 1),
(linenr_T)(curwin->w_cursor.lnum + count)) == FAIL)
@@ -2205,10 +2201,6 @@ do_join(
for (t = 0; t < count; ++t)
{
curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
#ifdef FEAT_PROP_POPUP
propcount += count_props((linenr_T) (curwin->w_cursor.lnum + t),
t > 0, t + 1 == count);
#endif
if (t == 0 && setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set the '[ mark.
@@ -2295,9 +2287,6 @@ do_join(
// allocate the space for the new line
newp_len = sumsize + 1;
#ifdef FEAT_PROP_POPUP
newp_len += propcount * sizeof(textprop_T);
#endif
newp = alloc(newp_len);
if (newp == NULL)
{
@@ -2316,8 +2305,15 @@ do_join(
* should not really be a problem.
*/
#ifdef FEAT_PROP_POPUP
props_remaining = propcount;
unpacked_memline_T um = um_open_at_no_props(
curwin->w_buffer, curwin->w_cursor.lnum, 0);
// um_open_at_no_props may have invalidated "curr".
int curr_off = (int)(curr - curr_start);
curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + count - 1));
curr += curr_off;
#endif
for (t = count - 1; ; --t)
{
int spaces_removed;
@@ -2338,9 +2334,8 @@ do_join(
mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, -t,
(long)(cend - newp - spaces_removed), spaces_removed);
#ifdef FEAT_PROP_POPUP
prepend_joined_props(newp + sumsize + 1, propcount, &props_remaining,
curwin->w_cursor.lnum + t, t == count - 1,
(long)(cend - newp), spaces_removed);
prepend_joined_props(&um, curwin->w_cursor.lnum + t,
t == count - 1, (long)(cend - newp), spaces_removed);
#endif
if (t == 0)
break;
@@ -2352,6 +2347,16 @@ do_join(
currsize = (int)STRLEN(curr);
}
#ifdef FEAT_PROP_POPUP
if (um.buf != NULL)
{
um_set_text(&um, newp);
um_reverse_props(&um);
um_close(&um);
newp = NULL; // um_set_text took ownership
}
else
#endif
ml_replace_len(curwin->w_cursor.lnum, newp, (colnr_T)newp_len, TRUE, FALSE);
if (setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
+1
View File
@@ -556,6 +556,7 @@ EXTERN long p_ph; // 'pumheight'
EXTERN long p_pw; // 'pumwidth'
EXTERN long p_pmw; // 'pummaxwidth'
EXTERN char_u *p_pb; // 'pumborder'
EXTERN char_u *p_pumopt; // 'pumopt'
EXTERN char_u *p_com; // 'comments'
EXTERN char_u *p_cpo; // 'cpoptions'
#ifdef FEAT_CSCOPE
+4
View File
@@ -2201,6 +2201,10 @@ static struct vimoption options[] =
{"pummaxwidth", "pmw", P_NUM|P_VI_DEF,
(char_u *)&p_pmw, PV_NONE, NULL, NULL,
{(char_u *)0L, (char_u *)0L} SCTX_INIT},
{"pumopt", NULL, P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_COLON,
(char_u *)&p_pumopt, PV_NONE,
did_set_pumopt, expand_set_pumopt,
{(char_u *)"", (char_u *)NULL} SCTX_INIT},
{"pumwidth", "pw", P_NUM|P_VI_DEF,
(char_u *)&p_pw, PV_NONE, NULL, NULL,
{(char_u *)15L, (char_u *)15L} SCTX_INIT},
+204 -69
View File
@@ -3706,6 +3706,197 @@ expand_set_rightleftcmd(optexpand_T *args, int *numMatches, char_u ***matches)
pum_set_margin(FALSE); \
} while (0)
/*
* Parse a border value from a pumopt "border:" token.
* Returns OK on success, FAIL on error.
*/
static int
parse_pumopt_border(char_u *val, int len)
{
// Use box-drawing characters only when 'encoding' is "utf-8" and
// 'ambiwidth' is "single".
int can_use_box_chars = (enc_utf8 && *p_ambw == 's');
char_u *token;
token = vim_strnsave(val, len);
if (token == NULL)
return FAIL;
if (can_use_box_chars && STRCMP(token, "single") == 0)
pum_set_border_chars(0x2500, 0x2502, 0x2500, 0x2502, // ─ │ ─ │
0x250c, 0x2510, 0x2518, 0x2514); // ┌ ┐ ┘ └
else if (can_use_box_chars && STRCMP(token, "double") == 0)
pum_set_border_chars(0x2550, 0x2551, 0x2550, 0x2551, // ═ ║ ═ ║
0x2554, 0x2557, 0x255D, 0x255A); // ╔ ╗ ╝ ╚
else if (can_use_box_chars && STRCMP(token, "round") == 0)
pum_set_border_chars(0x2500, 0x2502, 0x2500, 0x2502, // ─ │ ─ │
0x256d, 0x256e, 0x256f, 0x2570); // ╭ ╮ ╯ ╰
else if (STRCMP(token, "ascii") == 0)
pum_set_border_chars('-', '|', '-', '|', '+', '+', '+', '+');
else if (STRNCMP(token, "custom:", 7) == 0)
{
char_u *q = token + 7;
int out[8];
for (int i = 0; i < 8; i++)
{
if (*q == NUL || *q == ',')
{
vim_free(token);
return FAIL;
}
out[i] = mb_ptr2char(q);
mb_ptr2char_adv(&q);
if (i < 7)
{
if (*q != ';')
{
vim_free(token);
return FAIL;
}
q++;
}
}
if (*q != NUL && *q != ',')
{
vim_free(token);
return FAIL;
}
pum_set_border_chars(out[0], out[1], out[2], out[3], out[4], out[5],
out[6], out[7]);
}
else
{
vim_free(token);
return FAIL;
}
vim_free(token);
pum_set_border(TRUE);
return OK;
}
/*
* The 'pumopt' option is changed.
* Format: comma-separated key:value pairs.
* border:{single|double|round|ascii|custom:X;X;X;X;X;X;X;X}
* height:{n}
* width:{n}
* maxwidth:{n}
* opacity:{n}
* shadow
* margin (requires border)
*/
char *
did_set_pumopt(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
char_u *p;
int have_border = FALSE;
int have_margin = FALSE;
// Reset to defaults.
PUM_BORDER_CLEAR();
p_ph = 0;
p_pw = 15;
p_pmw = 0;
p_po = 100;
if (*varp == NULL || **varp == NUL)
return NULL;
for (p = *varp; p != NULL && *p != NUL; )
{
char_u *comma = vim_strchr(p, ',');
int len;
if (comma != NULL)
len = (int)(comma - p);
else
len = (int)STRLEN(p);
if (STRNCMP(p, "border:", 7) == 0)
{
if (have_border)
goto error;
have_border = TRUE;
if (parse_pumopt_border(p + 7, len - 7) == FAIL)
goto error;
}
else if (STRNCMP(p, "height:", 7) == 0)
{
long n = atol((char *)p + 7);
if (n < 0)
goto error;
p_ph = n;
}
else if (STRNCMP(p, "width:", 6) == 0)
{
long n = atol((char *)p + 6);
if (n < 0)
goto error;
p_pw = n;
}
else if (STRNCMP(p, "maxwidth:", 9) == 0)
{
long n = atol((char *)p + 9);
if (n < 0)
goto error;
p_pmw = n;
}
else if (STRNCMP(p, "opacity:", 8) == 0)
{
long n = atol((char *)p + 8);
if (n < 0 || n > 100)
goto error;
p_po = n;
}
else if (len == 6 && STRNCMP(p, "shadow", 6) == 0)
pum_set_shadow(TRUE);
else if (len == 6 && STRNCMP(p, "margin", 6) == 0)
{
have_margin = TRUE;
pum_set_margin(TRUE);
}
else
goto error;
if (comma != NULL)
p = comma + 1;
else
break;
}
if (have_margin && !have_border)
goto error;
// Invalidate cached background for opacity changes.
pum_opacity_changed();
return NULL;
error:
PUM_BORDER_CLEAR();
p_ph = 0;
p_pw = 15;
p_pmw = 0;
p_po = 100;
return e_invalid_argument;
}
int
expand_set_pumopt(optexpand_T *args, int *numMatches, char_u ***matches)
{
static char *(p_pumopt_values[]) = {"border:", "height:", "width:",
"maxwidth:", "opacity:", "shadow", "margin", NULL};
return expand_set_opt_string(
args,
p_pumopt_values,
ARRAY_LENGTH(p_pumopt_values) - 1,
numMatches,
matches);
}
/*
* The 'pumborder' option is changed.
* Rules:
@@ -3717,10 +3908,7 @@ expand_set_rightleftcmd(optexpand_T *args, int *numMatches, char_u ***matches)
did_set_pumborder(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
// Use box-drawing characters only when 'encoding' is "utf-8" and
// 'ambiwidth' is "single".
int can_use_box_chars = (enc_utf8 && *p_ambw == 's');
char_u *p, *token;
char_u *p;
int len;
int have_border = FALSE;
int have_margin = FALSE;
@@ -3732,89 +3920,36 @@ did_set_pumborder(optset_T *args)
for (p = *varp; p != NULL && *p != NUL; )
{
// end of token is either ',' or NUL
char_u *comma = vim_strchr(p, ',');
if (comma != NULL)
len = (int)(comma - p);
else
len = (int)STRLEN(p);
token = vim_strnsave(p, len);
if (token == NULL)
goto error;
if ((can_use_box_chars && (STRCMP(token, "single") == 0
|| STRCMP(token, "double") == 0
|| STRCMP(token, "round") == 0))
|| STRCMP(token, "ascii") == 0
|| (STRNCMP(token, "custom:", 7) == 0))
{
if (have_border)
{
// multiple border styles not allowed
vim_free(token);
goto error;
}
have_border = TRUE;
if (STRCMP(token, "single") == 0)
pum_set_border_chars(0x2500, 0x2502, 0x2500, 0x2502, // ─ │ ─ │
0x250c, 0x2510, 0x2518, 0x2514); // ┌ ┐ ┘ └
else if (STRCMP(token, "double") == 0)
pum_set_border_chars(0x2550, 0x2551, 0x2550, 0x2551, // ═ ║ ═ ║
0x2554, 0x2557, 0x255D, 0x255A); // ╔ ╗ ╝ ╚
else if (STRCMP(token, "round") == 0)
pum_set_border_chars(0x2500, 0x2502, 0x2500, 0x2502, // ─ │ ─ │
0x256d, 0x256e, 0x256f, 0x2570); // ╭ ╮ ╯ ╰
else if (STRCMP(token, "ascii") == 0)
pum_set_border_chars('-', '|', '-', '|', '+', '+', '+', '+');
else if (STRNCMP(token, "custom:", 7) == 0)
{
char_u *q = token + 7;
int out[8];
for (int i = 0; i < 8; i++)
{
if (*q == NUL || *q == ',')
goto error;
out[i] = mb_ptr2char(q);
mb_ptr2char_adv(&q);
if (i < 7)
{
if (*q != ';')
goto error; // must be semicolon
q++;
}
}
if (*q != NUL && *q != ',') // must end exactly after the 8th char
goto error;
pum_set_border_chars(out[0], out[1], out[2], out[3], out[4], out[5],
out[6], out[7]);
}
}
else if (STRCMP(token, "shadow") == 0)
if (STRNCMP(p, "shadow", len) == 0 && len == 6)
pum_set_shadow(TRUE);
else if (STRCMP(token, "margin") == 0)
else if (STRNCMP(p, "margin", len) == 0 && len == 6)
{
have_margin = TRUE;
pum_set_margin(TRUE);
}
else
{
vim_free(token);
goto error;
if (have_border)
goto error;
have_border = TRUE;
if (parse_pumopt_border(p, len) == FAIL)
goto error;
}
vim_free(token);
if (comma != NULL)
p = comma + 1; // move to next token (skip comma)
p = comma + 1;
else
break;
}
if (have_margin && !have_border)
goto error; // margin must be combined with border
goto error;
return NULL;
@@ -3827,12 +3962,12 @@ error:
int
expand_set_pumborder(optexpand_T *args, int *numMatches, char_u ***matches)
{
static char *(p_rlc_values[]) = {"single", "double", "round", "ascii",
static char *(p_pb_values[]) = {"single", "double", "round", "ascii",
"custom", "shadow", "margin", NULL};
return expand_set_opt_string(
args,
p_rlc_values,
ARRAY_LENGTH(p_rlc_values) - 1,
p_pb_values,
ARRAY_LENGTH(p_pb_values) - 1,
numMatches,
matches);
}
+6
View File
@@ -3210,6 +3210,12 @@ get_logfont(
}
}
break;
case L'f':
// Font features (e.g., "fss19=1").
// Parsed separately by gui_mch_init_font(); skip here.
while (*p && *p != L':')
p++;
break;
case L'q':
for (i = 0; i < (int)ARRAY_LENGTH(quality_pairs); ++i)
{
+7 -1
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Vim\n"
"Report-Msgid-Bugs-To: vim-dev@vim.org\n"
"POT-Creation-Date: 2026-04-06 13:30+0000\n"
"POT-Creation-Date: 2026-04-07 19:50+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -5867,6 +5867,9 @@ msgstr ""
msgid "E648: Invalid buffer identifier in close"
msgstr ""
msgid "E649: Invalid identifier name in defineAnnoType"
msgstr ""
msgid "E650: Invalid buffer identifier in defineAnnoType"
msgstr ""
@@ -10012,6 +10015,9 @@ msgstr ""
msgid "popup border style"
msgstr ""
msgid "additional options for the popup menu"
msgstr ""
msgid "user defined function for Insert mode completion"
msgstr ""
+152 -13
View File
@@ -406,11 +406,17 @@ pum_call_update_screen(void)
int
pum_under_menu(int row, int col, int only_redrawing)
{
int extra_left = pum_border + (pum_margin && pum_border ? 1 : 0);
int extra_right = pum_border + (pum_margin && pum_border ? 1 : 0)
+ (pum_shadow ? 2 : 0);
int extra_above = pum_border;
int extra_below = pum_border + (pum_shadow ? 1 : 0);
return (!only_redrawing || pum_will_redraw)
&& row >= pum_row
&& row < pum_row + pum_height
&& col >= pum_col - 1
&& col < pum_col + pum_width + pum_scrollbar;
&& row >= pum_row - extra_above
&& row < pum_row + pum_height + extra_below
&& col >= pum_col - 1 - extra_left
&& col < pum_col + pum_width + pum_scrollbar + extra_right;
}
/*
@@ -878,6 +884,42 @@ pum_align_order(int *order)
order[2] = is_default ? CPT_MENU : cia_flags % 10;
}
static void pum_free_bg(void);
/*
* Called when the pum opacity value has changed.
* Invalidates cached background and triggers redraw if pum is visible.
*/
void
pum_opacity_changed(void)
{
// Invalidate cached background so it gets re-saved.
pum_free_bg();
if (pum_visible())
{
// Force full screen clear so ScreenAttrs doesn't retain
// stale blended values from the previous pumopacity.
redraw_all_later(UPD_CLEAR);
call_update_screen = TRUE;
pum_redraw();
}
}
static void
pum_free_bg(void)
{
int k;
VIM_CLEAR(pum_bg_attrs);
VIM_CLEAR(pum_bg_lines);
VIM_CLEAR(pum_bg_linesUC);
for (k = 0; k < MAX_MCO; ++k)
VIM_CLEAR(pum_bg_linesC[k]);
pum_bg_top = 0;
pum_bg_bot = 0;
pum_bg_cols = 0;
}
/*
* Redraw the popup menu, using "pum_first" and "pum_selected".
*/
@@ -906,6 +948,7 @@ pum_redraw(void)
int orig_attr = -1;
int scroll_range = pum_size - pum_height;
bool override_success;
int opacity_active = (p_po > 0 && p_po < 100);
// Use current window for highlight overrides when using 'winhighlight'
override_success = push_highlight_overrides(curwin->w_hl, curwin->w_hl_len);
@@ -925,11 +968,97 @@ pum_redraw(void)
if (call_update_screen)
{
call_update_screen = FALSE;
// Do not redraw in pum_may_redraw() and don't draw in the area where
// the popup menu will be.
pum_will_redraw = TRUE;
update_screen(0);
pum_will_redraw = FALSE;
// Invalidate cached background if screen size changed (e.g.
// after window resize).
if (opacity_active && pum_bg_lines != NULL
&& (pum_bg_cols != screen_Columns
|| pum_bg_bot > screen_Rows))
pum_free_bg();
if (opacity_active && pum_bg_lines != NULL)
{
// Already have saved background; skip update_screen to avoid
// flickering. Just do a normal pum_will_redraw update.
pum_will_redraw = TRUE;
update_screen(0);
pum_will_redraw = FALSE;
}
else if (opacity_active)
{
// For opacity: draw background including the area under the
// pum, then save it.
pum_pretend_not_visible = TRUE;
update_screen(0);
pum_pretend_not_visible = FALSE;
// Save background to static buffers.
if (ScreenLines != NULL && ScreenAttrs != NULL)
{
int save_top, save_bot, save_ncells, k;
pum_free_bg();
save_top = pum_row - pum_border;
save_bot = pum_row + pum_height + pum_border
+ (pum_shadow ? 1 : 0) + 1;
if (save_top < 0)
save_top = 0;
if (save_bot > screen_Rows)
save_bot = screen_Rows;
pum_bg_top = save_top;
pum_bg_bot = save_bot;
pum_bg_cols = screen_Columns;
if (save_top < save_bot)
{
save_ncells = (save_bot - save_top) * screen_Columns;
pum_bg_attrs = LALLOC_MULT(sattr_T, save_ncells);
pum_bg_lines = LALLOC_MULT(schar_T, save_ncells);
if (enc_utf8)
{
pum_bg_linesUC = LALLOC_MULT(u8char_T, save_ncells);
for (k = 0; k < MAX_MCO; ++k)
pum_bg_linesC[k] = LALLOC_MULT(u8char_T,
save_ncells);
}
if (pum_bg_attrs != NULL && pum_bg_lines != NULL)
{
for (int r = save_top; r < save_bot; ++r)
{
int soff = (r - save_top) * screen_Columns;
int loff = LineOffset[r];
mch_memmove(pum_bg_attrs + soff,
ScreenAttrs + loff,
screen_Columns * sizeof(sattr_T));
mch_memmove(pum_bg_lines + soff,
ScreenLines + loff,
screen_Columns * sizeof(schar_T));
if (enc_utf8 && pum_bg_linesUC != NULL
&& ScreenLinesUC != NULL)
{
mch_memmove(pum_bg_linesUC + soff,
ScreenLinesUC + loff,
screen_Columns * sizeof(u8char_T));
for (k = 0; k < MAX_MCO; ++k)
if (pum_bg_linesC[k] != NULL
&& ScreenLinesC[k] != NULL)
mch_memmove(pum_bg_linesC[k] + soff,
ScreenLinesC[k] + loff,
screen_Columns
* sizeof(u8char_T));
}
}
}
}
}
}
else
{
// Do not redraw in pum_may_redraw() and don't draw in the area
// where the popup menu will be.
pum_will_redraw = TRUE;
update_screen(0);
pum_will_redraw = FALSE;
}
}
// never display more than we have
@@ -950,12 +1079,18 @@ pum_redraw(void)
screen_zindex = POPUPMENU_ZINDEX;
#endif
// Draw border and shadow first if enabled
// Draw border and shadow first if enabled, before setting blend
// so that border/shadow characters are drawn without opacity.
if (pum_border)
pum_draw_border();
if (pum_shadow)
pum_draw_shadow();
// Set blend for screen_puts_len / screen_fill to use.
// Only the pum content area should be blended, not border/shadow.
if (opacity_active)
screen_pum_blend = 100 - (int)p_po;
for (i = 0; i < pum_height; ++i)
{
idx = i + pum_first;
@@ -967,7 +1102,8 @@ pum_redraw(void)
#ifdef FEAT_RIGHTLEFT
if (pum_rl)
{
if (pum_col < curwin->w_wincol + curwin->w_width - 1 - pum_border)
if (pum_col < curwin->w_wincol + curwin->w_width - 1
- pum_border)
screen_putchar(' ', row, pum_col + 1, attr);
}
else
@@ -1032,8 +1168,8 @@ pum_redraw(void)
#ifdef FEAT_RIGHTLEFT
if (pum_rl)
screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
' ', orig_attr);
screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1,
' ', ' ', orig_attr);
else
#endif
screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
@@ -1043,6 +1179,8 @@ pum_redraw(void)
++row;
}
screen_pum_blend = 0;
#ifdef FEAT_PROP_POPUP
screen_zindex = 0;
#endif
@@ -1427,6 +1565,7 @@ pum_set_selected(int n, int repeat UNUSED)
void
pum_undisplay(void)
{
pum_free_bg();
pum_array = NULL;
redraw_all_later(UPD_NOT_VALID);
redraw_tabline = TRUE;
+115 -74
View File
@@ -46,6 +46,8 @@ static void may_start_message_win_timer(win_T *wp);
static int popup_on_cmdline = FALSE;
static void popup_adjust_position(win_T *wp);
static void redraw_under_popup_area(int winrow, int wincol, int height,
int width, int leftoff);
/*
* Get option value for "key", which is "line" or "col".
@@ -1316,9 +1318,9 @@ popup_adjust_position(win_T *wp)
int screen_ecol;
// Popup window is positioned relative to a text property.
if (find_visible_prop(prop_win,
if (!find_visible_prop(prop_win,
wp->w_popup_prop_type, wp->w_popup_prop_id,
&prop, &prop_lnum) == FAIL)
&prop, &prop_lnum))
{
// Text property is no longer visible, hide the popup.
// Unhiding the popup is done in check_popup_unhidden().
@@ -3107,6 +3109,14 @@ f_popup_settext(typval_T *argvars, typval_T *rettv UNUSED)
{
int id;
win_T *wp;
#ifdef FEAT_PROP_POPUP
int old_popup_active;
#endif
int old_winrow;
int old_wincol;
int old_popup_height;
int old_popup_width;
int old_popup_leftoff;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
@@ -3118,6 +3128,16 @@ f_popup_settext(typval_T *argvars, typval_T *rettv UNUSED)
if (wp == NULL)
return;
#ifdef FEAT_PROP_POPUP
old_popup_active = (wp->w_popup_flags & POPF_OPACITY)
&& wp->w_popup_blend > 0;
#endif
old_winrow = wp->w_winrow;
old_wincol = wp->w_wincol;
old_popup_height = popup_height(wp);
old_popup_width = popup_width(wp);
old_popup_leftoff = wp->w_popup_leftoff;
if (check_for_string_or_list_arg(argvars, 1) == FAIL)
return;
@@ -3132,6 +3152,17 @@ f_popup_settext(typval_T *argvars, typval_T *rettv UNUSED)
if (must_redraw < UPD_VALID)
must_redraw = UPD_VALID;
popup_adjust_position(wp);
#ifdef FEAT_PROP_POPUP
if (old_popup_active
&& (old_winrow != wp->w_winrow
|| old_wincol != wp->w_wincol
|| old_popup_height != popup_height(wp)
|| old_popup_width != popup_width(wp)
|| old_popup_leftoff != wp->w_popup_leftoff))
redraw_under_popup_area(old_winrow, old_wincol,
old_popup_height, old_popup_width, old_popup_leftoff);
#endif
}
/*
@@ -3316,6 +3347,49 @@ close_all_popups(int force)
return;
}
/*
* Force windows under a popup area to redraw.
*/
static void
redraw_under_popup_area(int winrow, int wincol, int height, int width, int leftoff)
{
int r;
for (r = winrow; r < winrow + height && r < screen_Rows; ++r)
{
int c;
win_T *prev_twp = NULL;
if (r >= cmdline_row)
{
clear_cmdline = TRUE;
continue;
}
for (c = wincol; c < wincol + width - leftoff && c < screen_Columns; ++c)
{
int line_cp = r;
int col_cp = c;
win_T *twp;
twp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP);
if (twp != NULL && twp != prev_twp)
{
prev_twp = twp;
if (line_cp < twp->w_height)
{
linenr_T lnum;
(void)mouse_comp_pos(twp, &line_cp, &col_cp, &lnum, NULL);
redrawWinline(twp, lnum);
}
else if (line_cp == twp->w_height)
twp->w_redr_status = TRUE;
}
}
}
}
/*
* popup_move({id}, {options})
*/
@@ -3329,6 +3403,9 @@ f_popup_move(typval_T *argvars, typval_T *rettv UNUSED)
int old_wincol;
int old_height;
int old_width;
int old_popup_height;
int old_popup_width;
int old_popup_leftoff;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
@@ -3349,6 +3426,9 @@ f_popup_move(typval_T *argvars, typval_T *rettv UNUSED)
old_wincol = wp->w_wincol;
old_height = wp->w_height;
old_width = wp->w_width;
old_popup_height = popup_height(wp);
old_popup_width = popup_width(wp);
old_popup_leftoff = wp->w_popup_leftoff;
apply_move_options(wp, dict);
@@ -3367,39 +3447,8 @@ f_popup_move(typval_T *argvars, typval_T *rettv UNUSED)
redraw_win_later(wp, UPD_NOT_VALID);
if ((wp->w_popup_flags & POPF_OPACITY) && wp->w_popup_blend > 0)
{
int total_h = old_height + popup_top_extra(wp)
+ wp->w_popup_border[2] + wp->w_popup_padding[2];
int row;
for (row = old_winrow;
row < old_winrow + total_h && row < screen_Rows; ++row)
{
if (row >= cmdline_row)
clear_cmdline = TRUE;
else
{
int line_cp = row;
int col_cp = old_wincol;
win_T *twp;
twp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP);
if (twp != NULL)
{
if (line_cp >= twp->w_height)
twp->w_redr_status = TRUE;
else
{
linenr_T lnum;
(void)mouse_comp_pos(twp, &line_cp, &col_cp,
&lnum, NULL);
redrawWinline(twp, lnum);
}
}
}
}
}
redraw_under_popup_area(old_winrow, old_wincol,
old_popup_height, old_popup_width, old_popup_leftoff);
}
}
@@ -3415,7 +3464,13 @@ f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
linenr_T old_firstline;
#ifdef FEAT_PROP_POPUP
int old_blend;
int old_popup_active;
#endif
int old_winrow;
int old_wincol;
int old_popup_height;
int old_popup_width;
int old_popup_leftoff;
int old_zindex;
int old_popup_flags;
char_u *old_scrollbar_highlight;
@@ -3441,7 +3496,14 @@ f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
old_firstline = wp->w_firstline;
#ifdef FEAT_PROP_POPUP
old_blend = wp->w_popup_blend;
old_popup_active = (wp->w_popup_flags & POPF_OPACITY)
&& wp->w_popup_blend > 0;
#endif
old_winrow = wp->w_winrow;
old_wincol = wp->w_wincol;
old_popup_height = popup_height(wp);
old_popup_width = popup_width(wp);
old_popup_leftoff = wp->w_popup_leftoff;
old_zindex = wp->w_zindex;
old_popup_flags = wp->w_popup_flags;
old_scrollbar_highlight = wp->w_scrollbar_highlight;
@@ -3514,6 +3576,17 @@ f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
// popup_adjust_position() only sets popup_mask_refresh when the
// position or size actually changed.
popup_adjust_position(wp);
#ifdef FEAT_PROP_POPUP
if (old_popup_active
&& (old_winrow != wp->w_winrow
|| old_wincol != wp->w_wincol
|| old_popup_height != popup_height(wp)
|| old_popup_width != popup_width(wp)
|| old_popup_leftoff != wp->w_popup_leftoff))
redraw_under_popup_area(old_winrow, old_wincol,
old_popup_height, old_popup_width, old_popup_leftoff);
#endif
}
/*
@@ -4234,7 +4307,7 @@ check_popup_unhidden(win_T *wp)
if ((wp->w_popup_flags & POPF_HIDDEN_FORCE) == 0
&& find_visible_prop(wp->w_popup_prop_win,
wp->w_popup_prop_type, wp->w_popup_prop_id,
&prop, &lnum) == OK)
&prop, &lnum))
{
wp->w_popup_flags &= ~POPF_HIDDEN;
wp->w_popup_prop_topline = 0; // force repositioning
@@ -4755,10 +4828,15 @@ draw_opacity_padding_cell(
&& utf_char2cells(ScreenLinesUC[base_off]) == 2)
{
// The left half still has the wide char on screen.
// Clear it to a space.
// Clear it to an unblended space: only the right half is
// covered by the popup background.
ScreenLines[base_off] = ' ';
ScreenLinesUC[base_off] = 0;
ScreenAttrs[base_off] = saved_screenattrs[base_save_off];
popup_set_base_screen_cell(row, base_col,
ScreenLines[base_off],
ScreenAttrs[base_off],
ScreenLinesUC[base_off]);
screen_char(base_off, row, base_col);
// Draw padding in the right half.
@@ -4778,43 +4856,6 @@ draw_opacity_padding_cell(
return;
}
// screen_line() already cleared the base cell (popup
// content was a space). Restore the full wide char from
// saved background so it shows through with opacity.
if (base_save_off >= 0
&& saved_screenlinesuc != NULL
&& saved_screenlinesuc[base_save_off] != 0
&& utf_char2cells(
saved_screenlinesuc[base_save_off]) == 2)
{
ScreenLines[base_off] =
saved_screenlines[base_save_off];
ScreenLinesUC[base_off] =
saved_screenlinesuc[base_save_off];
ScreenLines[off] = saved_screenlines[save_off];
ScreenLinesUC[off] = saved_screenlinesuc[save_off];
ScreenAttrs[base_off] =
saved_screenattrs[base_save_off];
ScreenAttrs[off] = saved_screenattrs[save_off];
int popup_attr_val =
get_win_attr(screen_opacity_popup);
int blend = screen_opacity_popup->w_popup_blend;
ScreenAttrs[base_off] = hl_blend_attr(
ScreenAttrs[base_off],
popup_attr_val, blend, TRUE);
ScreenAttrs[off] = ScreenAttrs[base_off];
popup_set_base_screen_cell(row, base_col,
ScreenLines[base_off],
ScreenAttrs[base_off],
ScreenLinesUC[base_off]);
popup_set_base_screen_cell(row, col,
ScreenLines[off], ScreenAttrs[off],
ScreenLinesUC[off]);
screen_char(base_off, row, base_col);
return;
}
// Draw padding in the right half.
ScreenLines[off] = ' ';
ScreenAttrs[off] = saved_screenattrs[save_off];
+1
View File
@@ -21,6 +21,7 @@ int get_gui_attr_idx(int attr, guicolor_T fg, guicolor_T bg);
void clear_hl_tables(void);
int hl_combine_attr(int char_attr, int prim_attr);
int hl_blend_attr(int char_attr, int popup_attr, int blend, int blend_fg);
int hl_pum_blend_attr(int char_attr, int popup_attr, int blend);
attrentry_T *syn_gui_attr2entry(int attr);
int syn_attr2attr(int attr);
attrentry_T *syn_term_attr2entry(int attr);
+2
View File
@@ -136,6 +136,8 @@ int expand_set_printoptions(optexpand_T *args, int *numMatches, char_u ***matche
char *did_set_renderoptions(optset_T *args);
char *did_set_rightleftcmd(optset_T *args);
int expand_set_rightleftcmd(optexpand_T *args, int *numMatches, char_u ***matches);
char *did_set_pumopt(optset_T *args);
int expand_set_pumopt(optexpand_T *args, int *numMatches, char_u ***matches);
char *did_set_pumborder(optset_T *args);
int expand_set_pumborder(optexpand_T *args, int *numMatches, char_u ***matches);
char *did_set_rulerformat(optset_T *args);
+1
View File
@@ -5,6 +5,7 @@ void pum_set_margin(int enable);
void pum_display(pumitem_T *array, int size, int selected);
void pum_call_update_screen(void);
int pum_under_menu(int row, int col, int only_redrawing);
void pum_opacity_changed(void);
void pum_redraw(void);
void pum_position_info_popup(win_T *wp);
void pum_undisplay(void);
+13 -3
View File
@@ -1,4 +1,13 @@
/* textprop.c */
unpacked_memline_T um_open(buf_T *buf);
bool um_goto_line(unpacked_memline_T *um, linenr_T lnum, int extra_props);
unpacked_memline_T um_open_at(buf_T *buf, linenr_T lnum, int extra_props);
bool um_set_text(unpacked_memline_T *um, char_u *text);
void um_reverse_props(unpacked_memline_T *um);
unpacked_memline_T um_open_at_no_props(buf_T *buf, linenr_T lnum, int prop_count);
void um_delete_prop(unpacked_memline_T *um, int index);
void um_close(unpacked_memline_T *um);
void um_abort(unpacked_memline_T *um);
int find_prop_type_id(char_u *name, buf_T *buf);
void f_prop_add(typval_T *argvars, typval_T *rettv);
void f_prop_add_list(typval_T *argvars, typval_T *rettv);
@@ -7,10 +16,11 @@ int get_text_props(buf_T *buf, linenr_T lnum, char_u **props, int will_change);
int prop_count_above_below(buf_T *buf, linenr_T lnum);
int count_props(linenr_T lnum, int only_starting, int last_line);
void sort_text_props(buf_T *buf, textprop_T *props, int *idxs, int count);
int find_visible_prop(win_T *wp, int type_id, int id, textprop_T *prop, linenr_T *found_lnum);
bool find_visible_prop(win_T *wp, int type_id, int id, textprop_T *prop, linenr_T *found_lnum);
char_u *props_add_count_header(char_u *line, int line_len, int textlen, int *new_len);
void add_text_props(linenr_T lnum, textprop_T *text_props, int text_prop_count);
proptype_T *text_prop_type_by_id(buf_T *buf, int id);
int text_prop_type_valid(buf_T *buf, textprop_T *prop);
bool text_prop_type_valid(buf_T *buf, textprop_T *prop);
void f_prop_clear(typval_T *argvars, typval_T *rettv);
void f_prop_find(typval_T *argvars, typval_T *rettv);
void f_prop_list(typval_T *argvars, typval_T *rettv);
@@ -24,5 +34,5 @@ void clear_global_prop_types(void);
void clear_buf_prop_types(buf_T *buf);
int adjust_prop_columns(linenr_T lnum, colnr_T col, int bytes_added, int flags);
void adjust_props_for_split(linenr_T lnum_props, linenr_T lnum_top, int kept, int deleted, int at_eol);
void prepend_joined_props(char_u *new_props, int propcount, int *props_remaining, linenr_T lnum, int last_line, long col, int removed);
void prepend_joined_props(unpacked_memline_T *um, linenr_T lnum, int last_line, long col, int removed);
/* vim: set ft=c : */
+28 -2
View File
@@ -2680,6 +2680,34 @@ screen_fill(
}
skip_opacity_fill:
#endif
// For pum opacity: blend pum background with underlying.
// Only for space cells; text cells are handled normally.
if (screen_pum_blend > 0 && c == ' '
&& pum_bg_attrs != NULL
&& row >= pum_bg_top && row < pum_bg_bot
&& col < pum_bg_cols)
{
int soff = (row - pum_bg_top) * pum_bg_cols + col;
int underlying_attr = pum_bg_attrs[soff];
// Restore underlying character so text shows through.
ScreenLines[off] = pum_bg_lines[soff];
if (enc_utf8 && pum_bg_linesUC != NULL
&& ScreenLinesUC != NULL)
{
int k;
ScreenLinesUC[off] = pum_bg_linesUC[soff];
for (k = 0; k < MAX_MCO; ++k)
if (pum_bg_linesC[k] != NULL
&& ScreenLinesC[k] != NULL)
ScreenLinesC[k][off] = pum_bg_linesC[k][soff];
}
// Keep underlying fg, blend bg only.
ScreenAttrs[off] = hl_pum_blend_attr(underlying_attr,
attr, screen_pum_blend);
screen_char(off, row, col);
goto next_col;
}
#if defined(FEAT_GUI) || defined(UNIX)
// The bold trick may make a single row of pixels appear in
// the next character. When a bold character is removed, the
@@ -2736,9 +2764,7 @@ skip_opacity_fill:
if (!did_delete || c != ' ')
screen_char(off, row, col);
}
#ifdef FEAT_PROP_POPUP
next_col:
#endif
ScreenCols[off] = -1;
++off;
if (col == start_col)
+43 -3
View File
@@ -893,13 +893,22 @@ typedef struct memline
typedef struct textprop_S
{
colnr_T tp_col; // start column (one based, in bytes)
colnr_T tp_len; // length in bytes, when tp_id is negative used
// for left padding plus one
colnr_T tp_len; // length in bytes; for virtual text props
// this is STRLEN(vtext) (not including NUL)
int tp_id; // identifier
int tp_type; // property type
int tp_flags; // TP_FLAG_ values
int tp_padleft; // left padding between text line and virtual
// text
union // For virtual text props (tp_id < 0):
{ // check TP_FLAG_VTEXT_PTR in tp_flags to
// determine which member is active.
colnr_T tp_text_offset; // offset to vtext string from the
// prop_count position in the memline
// (when TP_FLAG_VTEXT_PTR is NOT set)
char_u *tp_text; // pointer to virtual text string
// (when TP_FLAG_VTEXT_PTR IS set)
} u;
} textprop_T;
#define TP_FLAG_CONT_NEXT 0x1 // property continues in next line
@@ -913,10 +922,42 @@ typedef struct textprop_S
#define TP_FLAG_WRAP 0x080 // virtual text wraps - when missing
// text is truncated
#define TP_FLAG_START_INCL 0x100 // "start_incl" copied from proptype
#define TP_FLAG_DELETED 0x200 // marked for deletion in
// unpacked_memline_T
#define TP_FLAG_VTEXT_PTR 0x400 // u.tp_text access is valid
#define PROP_COUNT_SIZE sizeof(uint16_t) // size of prop_count in memline
#define PROP_TEXT_MIN_CELLS 4 // minimum number of cells to use for
// the text, even when truncating
/*
* An unpacked form of a single memline with text properties.
*
* When packed in a memline, the format is:
* [line text] [NUL] [textprop_T...] [vtext strings...]
* Virtual text props use u.tp_text_offset (relative to the start of props
* area). When unpacked, u.tp_text is a pointer: either into the memline
* data (LOADED) or to separately allocated memory (DETACHED).
*
* States:
* - LOADED: text and u.tp_text point into the memline. Read-only.
* - DETACHED: text and u.tp_text are separately allocated. Writable.
* - CLOSED: buf == NULL. Unusable (error recovery).
*/
typedef struct unpacked_memline_S
{
buf_T *buf; // the line's buffer (NULL = closed)
linenr_T lnum; // line number (0 = no line loaded)
bool detached; // true when text/vtext are allocated
colnr_T text_size; // size of text including NUL
char_u *text; // NUL-terminated text
int prop_size; // number of allocated prop slots
int prop_count; // number of properties
textprop_T *props; // property array
bool text_changed; // true if text was modified
} unpacked_memline_T;
/*
* Structure defining a property type.
*/
@@ -3556,7 +3597,6 @@ struct file_buffer
int b_has_textprop; // TRUE when text props were added
hashtab_T *b_proptypes; // text property types local to buffer
proptype_T **b_proparray; // entries of b_proptypes sorted on tp_id
garray_T b_textprop_text; // stores text for props, index by (-id - 1)
#endif
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
+2
View File
@@ -338,6 +338,7 @@ NEW_TESTS = \
test_textformat \
test_textobjects \
test_textprop \
test_textprop2 \
test_timers \
test_true_false \
test_trycatch \
@@ -603,6 +604,7 @@ NEW_TESTS_RES = \
test_textformat.res \
test_textobjects.res \
test_textprop.res \
test_textprop2.res \
test_timers.res \
test_true_false.res \
test_trycatch.res \
+1 -1
View File
@@ -9,4 +9,4 @@
|~+0#4040ff13&| @58
|~| @58
|~| @58
|:+0#0000000&|s|e|t| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| |f|o|l|d|c|o|l|u|m|n|=|3| |c|u|r|s|o|r|l|i|n|3|,|5| @10|A|l@1|
| +0#0000000&@41|3|,|5| @10|A|l@1|
+1 -1
View File
@@ -9,4 +9,4 @@
|~+0#4040ff13#ffffff0| @58
|~| @58
|~| @58
|:+0#0000000&|s|e|t| |s|i|g|n|c|o|l|u|m|n|=|y|e|s| |f|o|l|d|c|o|l|u|m|n|=|3| @9|4|,|4| @10|A|l@1|
| +0#0000000&@41|4|,|4| @10|A|l@1|
+20
View File
@@ -0,0 +1,20 @@
|h+0&#ffffff0|e|l@1|o| |w|o|r|l|d| @63
|h|e|l@1|o| |v|i|m| @65
|h|e|l@1|o| |o|p|a|c|i|t|y| @61
|h|e|l|p| |m|e| @67
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|h|e|l@1|o> @69
|h+0#0000001#e0e0e08|e|l@1|o| @9| +0#4040ff13#ffffff0@59
|h+0#0000001#ffd7ff255|e|l|p| @10| +0#4040ff13#ffffff0@59
|~| @73
|~| @73
|-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |2| +0#0000000&@33
+20
View File
@@ -0,0 +1,20 @@
|h+0&#ffffff0|e|l@1|o| |w|o|r|l|d| @63
|h|e|l@1|o| |v|i|m| @65
|h|e|l@1|o| |o|p|a|c|i|t|y| @61
|h|e|l|p| |m|e| @67
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G|R|O|U|N|D|B|A|C|K|G
|R|O|U|N|D| @69
|h|e|l@1|o> @69
|h+0#0000001#e0e0e08|e|l@1|o| @9| +0#4040ff13#ffffff0@59
|h+0#0000001#ffd7ff255|e|l|p| @10| +0#4040ff13#ffffff0@59
|~| @73
|~| @73
|-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |2| +0#0000000&@33
+2 -2
View File
@@ -113,8 +113,8 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
'endAtomic_Test' : '0:endAtomic!95\n',
'AnnoScale_Test' : "".join(['2:defineAnnoType!60 ' + str(i) + ' "s' + str(i) + '" "x" "=>" blue none\n' for i in range(2, 26)]),
'detach_Test' : '2:close!96\n1:close!97\nDETACH\n',
'specialKeys_overflow_Test' : '0:specialKeys!200 "' + 'A'*80 + '-X"\n'
'specialKeys_overflow_Test' : '0:specialKeys!200 "' + 'A'*80 + '-X"\n',
'defineAnnoType_injection_Test': '1:defineAnnoType!1 "MySign guifg=red|call writefile([\'inject\'],\'Xinject\')|" "tooltip" "glyphFile" 1 2\n'
}
# execute the specified test
if cmd not in testmap:
+38
View File
@@ -1024,4 +1024,42 @@ func Test_nb_specialKeys_overflow()
call s:run_server('Nb_specialKeys_overflow')
endfunc
func Nb_defineAnnoType_injection(port)
call writefile([], "Xnetbeans", 'D')
let g:last = 0
exe 'nbstart :localhost:' .. a:port .. ':bunny'
call assert_true(has("netbeans_enabled"))
call WaitFor('len(ReadXnetbeans()) > (g:last + 2)')
let g:last += 3
split Xcmdbuf
let cmdbufnr = bufnr()
call WaitFor('len(ReadXnetbeans()) > (g:last + 2)')
let g:last += 3
hide
sleep 1m
call delete('Xinject')
call appendbufline(cmdbufnr, '$', 'defineAnnoType_injection_Test')
" E475 from :sign is expected — catch it before RunServer sees it.
" give it a bit of time to process it
try
sleep 500m
catch /E475/
catch /E649/
endtry
" Injected call must not have created this file
call assert_false(filereadable('Xinject'))
call delete('Xinject')
bwipe! Xcmdbuf
nbclose
endfunc
func Test_nb_defineAnnoType_injection()
call ch_log('Test_nb_defineAnnoType_injection')
call s:run_server('Nb_defineAnnoType_injection')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+46
View File
@@ -2434,4 +2434,50 @@ func Test_popup_shadow_hiddenchar()
call StopVimInTerminal(buf)
endfunc
" Test pumopt opacity with screendump: background text should show through
func Test_pumopt_opacity_screendump()
CheckScreendump
let lines =<< trim END
set pumopt=opacity:50
set completeopt=menu
call setline(1, ['hello world', 'hello vim', 'hello opacity', 'help me'])
for i in range(5)
call append(line('$'), repeat('BACKGROUND', 8))
endfor
normal gg
END
call writefile(lines, 'Xpumoptopacity', 'D')
let buf = RunVimInTerminal('-S Xpumoptopacity', {})
call TermWait(buf)
call term_sendkeys(buf, "Gohel\<C-N>")
call TermWait(buf, 100)
call VerifyScreenDump(buf, 'Test_pumopt_opacity_50', {})
call term_sendkeys(buf, "\<C-E>\<Esc>u")
call TermWait(buf)
call StopVimInTerminal(buf)
endfunc
" Test pumopt opacity:100 (fully opaque, same as default)
func Test_pumopt_opacity_100()
CheckScreendump
let lines =<< trim END
set pumopt=opacity:100
set completeopt=menu
call setline(1, ['hello world', 'hello vim', 'hello opacity', 'help me'])
for i in range(5)
call append(line('$'), repeat('BACKGROUND', 8))
endfor
normal gg
END
call writefile(lines, 'Xpumoptopacity100', 'D')
let buf = RunVimInTerminal('-S Xpumoptopacity100', {})
call TermWait(buf)
call term_sendkeys(buf, "Gohel\<C-N>")
call TermWait(buf, 100)
call VerifyScreenDump(buf, 'Test_pumopt_opacity_100', {})
call term_sendkeys(buf, "\<C-E>\<Esc>u")
call TermWait(buf)
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+7 -7
View File
@@ -3565,7 +3565,7 @@ func Test_props_with_text_after_nowrap()
let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 12, cols: 60})
call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {})
call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3 cursorline\<CR>")
call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3 cursorline\<CR>\<C-L>")
call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_2', {})
call term_sendkeys(buf, "j")
@@ -3975,15 +3975,15 @@ func Test_removed_prop_with_text_cleans_up_array()
call setline(1, 'some text here')
call prop_type_add('some', #{highlight: 'ErrorMsg'})
let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"})
call assert_equal(-1, id1)
call assert_true(id1 < 0)
let id2 = prop_add(1, 10, #{type: 'some', text: "HERE"})
call assert_equal(-2, id2)
call assert_true(id2 < id1)
" removing the props resets the index
" IDs are not recycled after removal; new IDs keep decreasing.
call prop_remove(#{id: id1})
call prop_remove(#{id: id2})
let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"})
call assert_equal(-1, id1)
let id3 = prop_add(1, 5, #{type: 'some', text: "SOME"})
call assert_true(id3 < id2)
call prop_type_delete('some')
bwipe!
@@ -4672,7 +4672,7 @@ func Test_error_when_using_negative_id()
" Negative id is always rejected. Before the fix, prop_add() with a negative
" id succeeded when no virtual text existed, then prop_list() would dereference
" a NULL pointer (b_textprop_text.ga_data) and crash.
" a NULL pointer and crash.
call assert_fails("call prop_add(1, 1, #{type: 'test1', length: 1, id: -1})", 'E1293:')
call assert_equal([], prop_list(1))
+431
View File
@@ -0,0 +1,431 @@
" Additional tests for defining text property types and adding text properties
" to the buffer.
CheckFeature textprop
source util/screendump.vim
" Find a property of a given type on a given line.
func s:PropForType(lnum, type_name)
for p in prop_list(a:lnum)
if p['type'] == a:type_name
return p
endif
endfor
return {}
endfunc
" Clean up property types and wipe buffer.
func s:CleanupPropTypes(types)
for name in a:types
call prop_type_delete(name)
endfor
bwipe!
endfunc
" Set up buffer content and properties used by multiple tests.
"
" Properties:
" type '1': line 2 col 2 -> line 4 col 9 (multiline highlight)
" type '2': line 2 col 3 -> line 2 col 7 (single line highlight)
" type '2': line 3 col 3 -> line 3 col 8 (single line highlight)
" type '2': line 4 col 3 -> line 4 col 9 (single line highlight)
" type '3': line 2 col 5 -> line 4 col 9 (multiline highlight)
func s:Setup_multiline_props_1()
new
call setline(1, ['Line1', 'Line.2', 'Line..3', 'Line...4'])
silent! call prop_type_delete('1')
silent! call prop_type_delete('2')
silent! call prop_type_delete('3')
call prop_type_add('1', {'highlight': 'DiffAdd'})
call prop_type_add('2', {'highlight': 'DiffChange'})
call prop_type_add('3', {'highlight': 'DiffDelete'})
call prop_add(2, 2, {'type': '1', 'id': 42, 'end_lnum': 4, 'end_col': 9})
call prop_add(2, 3, {'type': '2', 'id': 42, 'end_lnum': 2, 'end_col': 7})
call prop_add(3, 3, {'type': '2', 'id': 42, 'end_lnum': 3, 'end_col': 8})
call prop_add(4, 3, {'type': '2', 'id': 42, 'end_lnum': 4, 'end_col': 9})
call prop_add(2, 5, {'type': '3', 'id': 42, 'end_lnum': 4, 'end_col': 9})
" Sanity check.
call assert_equal(4, line('$'))
call assert_equal(0, len(prop_list(1)))
call assert_equal(3, len(prop_list(2)))
call assert_equal(3, len(prop_list(3)))
call assert_equal(3, len(prop_list(4)))
endfunc
" Set up buffer with a multiline property spanning line 1 col 4 -> line 3 col 4.
func s:Setup_start_end_prop()
new
call setline(1, ['Line.1', 'Line..2', 'Line...3', 'Line....4'])
silent! call prop_type_delete('1')
call prop_type_add('1', {'highlight': 'DiffAdd'})
call prop_add(1, 4, {'type': '1', 'id': 42, 'end_lnum': 3, 'end_col': 4})
endfunc
" The substitute command should adjust marks when one or more whole lines are
" deleted.
func Test_subst_adjusts_marks()
" Buffer: 4 lines with a single multiline property spanning all lines.
" type '1': line 1 col 1 -> line 4 col 10
func DoEditAndCheck(edit, expected_marks, expected_nlines) closure
new
call setline(1, ['Line.1', 'Line..2', 'Line...3', 'Line....4'])
silent! call prop_type_delete('1')
call prop_type_add('1', {'highlight': 'DiffAdd'})
call prop_add(1, 1, {'type': '1', 'id': 42, 'end_lnum': 4, 'end_col': 10})
call setpos("'a", [0, 1, 1])
call setpos("'b", [0, 2, 1])
call setpos("'c", [0, 3, 1])
call setpos("'d", [0, 4, 1])
set undolevels&
let msg = printf('Edit command = "%s"', a:edit)
execute a:edit
call assert_equal(a:expected_nlines, line('$'), msg)
call assert_equal(a:expected_marks[0], getpos("'a"), msg .. ', mark a')
call assert_equal(a:expected_marks[1], getpos("'b"), msg .. ', mark b')
call assert_equal(a:expected_marks[2], getpos("'c"), msg .. ', mark c')
call assert_equal(a:expected_marks[3], getpos("'d"), msg .. ', mark d')
" Undo and verify original state is restored.
:undo
call assert_equal(4, line('$'), msg .. ', post-undo')
call assert_equal('Line.1', getline(1), msg .. ', post-undo line 1')
call assert_equal([0, 1, 1, 0], getpos("'a"), msg .. ', post-undo mark a')
call assert_equal([0, 2, 1, 0], getpos("'b"), msg .. ', post-undo mark b')
call assert_equal([0, 3, 1, 0], getpos("'c"), msg .. ', post-undo mark c')
call assert_equal([0, 4, 1, 0], getpos("'d"), msg .. ', post-undo mark d')
call prop_type_delete('1')
bwipe!
endfunc
" Delete line 1.
let expected = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 2, 1, 0], [0, 3, 1, 0]]
for edit in [':1 substitute/Line.1\n//', ':1 delete', 'normal 1GVx']
call DoEditAndCheck(edit, expected, 3)
endfor
return
" NOTE: The tests below are disabled in the original too (after 'return').
" Delete line 2.
let expected = [[0, 1, 1, 0], [0, 0, 0, 0], [0, 2, 1, 0], [0, 3, 1, 0]]
for edit in [':2 substitute/Line..2\n//', ':1 substitute/\nLine..2//',
\ '2: delete', 'normal 2GVx']
call DoEditAndCheck(edit, expected, 3)
endfor
" Delete line 4.
let expected = [[0, 1, 1, 0], [0, 2, 1, 0], [0, 3, 1, 0], [0, 0, 0, 0]]
for edit in [':3 substitute/\nLine....4//', '4: delete', 'normal 4GVx']
call DoEditAndCheck(edit, expected, 3)
endfor
" Delete lines 2-3.
let expected = [[0, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 2, 1, 0]]
for edit in [':2,3 substitute/Line.*[23]\n//',
\ ':2,3 substitute/\%(Line[.]*[23]\n\)*',
\ '2,3: delete', 'normal 2GVjx']
call DoEditAndCheck(edit, expected, 2)
endfor
" Delete lines 1-3.
let expected = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 1, 1, 0]]
for edit in [':1,$ substitute/Line.*[123]\n//',
\ ':1,$ substitute/\%(Line[.]*[123]\n\)*',
\ '1,3: delete', 'normal 1GVjjx']
call DoEditAndCheck(edit, expected, 1)
endfor
" Delete all lines.
let expected = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
for edit in [':1,$ substitute/Line.*[1234]\n//',
\ ':1,$ substitute/\%(Line[.]*[1234]\n\)*//',
\ '1,4: delete', 'normal 1GVjjjx']
call DoEditAndCheck(edit, expected, 1)
endfor
" Delete lines 3-4.
let expected = [[0, 1, 1, 0], [0, 2, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
for edit in [':2,$ substitute/\n\%(Line.*[34]\n\?\)*//',
\ '3,4: delete', 'normal 3GVjx']
call DoEditAndCheck(edit, expected, 2)
endfor
" Delete lines 2-4.
let expected = [[0, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
for edit in [':1,$ substitute/\n\%(Line.*[234]\n\?\)*//',
\ '2,4: delete', 'normal 2GVjjx']
call DoEditAndCheck(edit, expected, 1)
endfor
endfunc
" The substitute command should correctly drop floating, virtual
" properties when lines are deleted.
func Test_multiline_substitute_del_lines_drops_virt_text_props()
" Helper to set up the buffer with virtual text properties.
" When a:virt_k_col is 1, 'virt-k' is at line 1 col 1 (floating);
" when 4, it is at line 1 col 4 (inline).
func SetupVirtProps(virt_k_col)
new
call setline(1, ['Line.1', 'Line..2', 'Line...3', 'Line....4'])
for s:t in ['1', '2', '3', '4', '7', '8']
silent! call prop_type_delete(s:t)
endfor
call prop_type_add('1', {'highlight': 'DiffAdd'})
call prop_type_add('2', {'highlight': 'DiffChange', 'end_incl': 1})
call prop_type_add('3', {'highlight': 'DiffDelete'})
call prop_type_add('4', {'highlight': 'DiffText'})
call prop_type_add('7', {'highlight': 'WarningMsg'})
call prop_type_add('8', {'highlight': 'Directory'})
" Floating virtual text.
call prop_add(1, 0, {'type': '1', 'text': 'virt-a', 'text_align': 'right'})
call prop_add(1, 0, {'type': '2', 'text': 'virt-b', 'text_align': 'right'})
call prop_add(2, 0, {'type': '3', 'text': 'virt-c', 'text_align': 'right'})
call prop_add(2, 0, {'type': '4', 'text': 'virt-d', 'text_align': 'right'})
call prop_add(3, 0, {'type': '4', 'text': 'virt-e', 'text_align': 'right'})
call prop_add(4, 0, {'type': '3', 'text': 'virt-g', 'text_align': 'right'})
call prop_add(4, 0, {'type': '7', 'text': 'virt-h', 'text_align': 'right'})
" Inline virtual text.
call prop_add(1, a:virt_k_col, {'type': '8', 'text': 'virt-k'})
" Highlight property spanning lines 1-4.
call prop_add(1, 1, {'type': '2', 'id': 42, 'end_lnum': 4, 'end_col': 4})
call prop_add(4, 4, {'type': '3', 'id': 42, 'end_lnum': 4, 'end_col': 7})
endfunc
" Join lines 1-2.
call SetupVirtProps(1)
1,2 substitute /e.1\nL/e.1 L/
call assert_equal(3, line('$'))
call assert_equal('Line.1 Line..2', getline(1))
call assert_equal(4, len(prop_list(1)))
call s:CleanupPropTypes(['1', '2', '3', '4', '7', '8'])
" Join lines 1-3.
call SetupVirtProps(1)
1,3 substitute /e.1\nLine..2\nL/e.1 L/
call assert_equal(2, line('$'))
call assert_equal('Line.1 Line...3', getline(1))
" NOTE: Original PR expected value is 3
call assert_equal(4, len(prop_list(1)))
call s:CleanupPropTypes(['1', '2', '3', '4', '7', '8'])
" Join lines 1-4.
call SetupVirtProps(1)
1,4 substitute /e.1\nLine..2\nLine...3\nL/e.1 L/
call assert_equal(1, line('$'))
call assert_equal('Line.1 Line....4', getline(1))
call assert_equal(5, len(prop_list(1)))
call s:CleanupPropTypes(['1', '2', '3', '4', '7', '8'])
" Second variant: inline virtual text at col 4.
call SetupVirtProps(4)
1,2 substitute /e.1\nL/e.1 L/
call assert_equal(3, line('$'))
call assert_equal(4, len(prop_list(1)))
call s:CleanupPropTypes(['1', '2', '3', '4', '7', '8'])
endfunc
" Deletion of text starting a multiline property should adjust next line.
func Test_text_deletion_of_start_to_eol_adjusts_multiline_property()
" Partial delete: property is shortened but not removed.
call s:Setup_start_end_prop()
normal 1G03l2x
call assert_equal('Lin1', getline(1))
call assert_equal(1, len(prop_list(1)))
call assert_equal(2, prop_list(1)[0]['length'])
call prop_type_delete('1')
bwipe!
" Full delete of start: property should be removed from line 1.
for edit in ['normal 1G03ld$', 'normal 1G03l3x',
\ 'normal 1G03lv x', '1 substitute /e.1//']
call s:Setup_start_end_prop()
execute edit
let msg = printf('op="%s"', edit)
call assert_equal([], prop_list(1), msg)
call prop_type_delete('1')
bwipe!
endfor
endfunc
" Deletion of text ending a multiline property should adjust previous line.
func Test_text_deletion_of_end_to_sol_adjusts_multiline_property()
" Partial delete: property end is adjusted but not removed.
call s:Setup_start_end_prop()
normal 3G02x
call assert_equal('ne...3', getline(3))
call assert_equal(1, len(prop_list(3)))
call assert_equal(0, prop_list(3)[0]['start'])
call prop_type_delete('1')
bwipe!
" Full delete of ending portion: property should be removed from line 3.
for edit in ['normal 3G03x', 'normal 3G0v x', '3 substitute /Lin//']
call s:Setup_start_end_prop()
execute edit
let msg = printf('op="%s"', edit)
call assert_equal([], prop_list(3), msg)
call prop_type_delete('1')
bwipe!
endfor
endfunc
" Inline text properties should be removed when surrounding text is removed.
func Test_text_deletion_removes_inline_virtual_text()
func SetupVirtText(start_incl, end_incl)
new
call setline(1, ['The line with properties....'])
let opts = {'highlight': 'DiffChange'}
if a:start_incl
let opts['start_incl'] = 1
endif
if a:end_incl
let opts['end_incl'] = 1
endif
silent! call prop_type_delete('2')
call prop_type_add('2', opts)
call prop_add(1, 7, {'type': '2', 'text': 'xxx'})
endfunc
" Test all combinations of start_incl/end_incl.
for [si, ei] in [[0, 0], [1, 0], [0, 1], [1, 1]]
" Deletion of one char before virtual text: property stays.
for edit in ['normal 1G05lx', '1 substitute /i//', 'normal 1G05lvx']
call SetupVirtText(si, ei)
execute edit
let msg = printf('si=%d ei=%d op="%s"', si, ei, edit)
call assert_equal(1, len(prop_list(1)), msg)
call assert_equal(6, prop_list(1)[0]['col'], msg)
call prop_type_delete('2')
bwipe!
endfor
" Deletion of one char after virtual text: property stays.
for edit in ['normal 1G06lx', '1 substitute /n//', 'normal 1G06lvx']
call SetupVirtText(si, ei)
execute edit
let msg = printf('si=%d ei=%d op="%s"', si, ei, edit)
call assert_equal(1, len(prop_list(1)), msg)
call assert_equal(7, prop_list(1)[0]['col'], msg)
call prop_type_delete('2')
bwipe!
endfor
" Deletion of both chars around virtual text: property is removed.
for edit in ['normal 1G05l2x', '1 substitute /in//', 'normal 1G05lv x']
call SetupVirtText(si, ei)
execute edit
let msg = printf('si=%d ei=%d op="%s"', si, ei, edit)
call assert_equal([], prop_list(1), msg)
call prop_type_delete('2')
bwipe!
endfor
endfor
endfunc
" Removing a multiline property from the last line should fix the property
" on the penultimate line.
func Test_multiline_prop_partial_remove_last_using_remove()
call s:Setup_multiline_props_1()
call prop_remove({'type': '3'}, 4)
call assert_equal(1, s:PropForType(3, '3')['end'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Removing a multiline property from the penultimate line should fix the
" properties on the previous and last lines.
func Test_multiline_prop_partial_remove_penultimate_using_remove()
call s:Setup_multiline_props_1()
call prop_remove({'type': '3'}, 3)
call assert_equal(1, s:PropForType(2, '3')['end'])
call assert_equal(1, s:PropForType(4, '3')['start'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Removing all properties from the first line should fix the properties
" on the second line.
func Test_multiline_prop_partial_remove_first_using_clear()
call s:Setup_multiline_props_1()
call prop_clear(2)
call assert_equal(1, s:PropForType(3, '3')['start'])
call assert_equal(1, s:PropForType(3, '1')['start'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Removing all multiline properties from the last line should fix the
" properties on the penultimate line.
func Test_multiline_prop_partial_remove_last_using_clear()
call s:Setup_multiline_props_1()
call prop_clear(4)
call assert_equal(1, s:PropForType(3, '3')['end'])
call assert_equal(1, s:PropForType(3, '1')['end'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Removing all multiline properties from the penultimate line should fix the
" properties on the previous and last lines.
func Test_multiline_prop_partial_remove_penultimate_using_clear()
call s:Setup_multiline_props_1()
call prop_clear(3)
call assert_equal(1, s:PropForType(2, '3')['end'])
call assert_equal(1, s:PropForType(4, '3')['start'])
call assert_equal(1, s:PropForType(2, '1')['end'])
call assert_equal(1, s:PropForType(4, '1')['start'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Deleting the first line with multiline properties should fix the properties
" on the second line.
func Test_multiline_prop_delete_first_line()
call s:Setup_multiline_props_1()
:2 delete
call assert_equal(3, line('$'))
call assert_equal(1, s:PropForType(2, '1')['start'])
call assert_equal(1, s:PropForType(2, '3')['start'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Deleting the last line with multiline properties should fix the properties
" on the penultimate line.
func Test_multiline_prop_delete_last_line()
call s:Setup_multiline_props_1()
:4 delete
call assert_equal(3, line('$'))
call assert_equal(1, s:PropForType(3, '1')['end'])
call assert_equal(1, s:PropForType(3, '3')['end'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" Deleting the penultimate line with multiline properties should keep
" the properties spanning lines.
func Test_multiline_prop_delete_penultimate_line()
call s:Setup_multiline_props_1()
:3 delete
call assert_equal(3, line('$'))
call assert_equal(0, s:PropForType(2, '1')['end'])
call assert_equal(0, s:PropForType(2, '3')['end'])
call assert_equal(0, s:PropForType(3, '1')['start'])
call assert_equal(0, s:PropForType(3, '3')['start'])
call s:CleanupPropTypes(['1', '2', '3'])
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+5
View File
@@ -291,6 +291,11 @@ let test_values = {
\ 'double,margin,shadow', 'custom:─;│;─;│;┌;┐;┘;└,shadow',
\ 'ascii,margin'],
\ ['xxx', 'margin', 'margin,shadow', 'custom:', 'custom:+;']],
\ 'pumopt': [['', 'border:single', 'border:double', 'border:ascii',
\ 'height:10', 'width:20', 'maxwidth:30', 'opacity:50',
\ 'border:double,margin,shadow',
\ 'height:10,width:20,maxwidth:30,opacity:80'],
\ ['xxx', 'opacity:200', 'opacity:-1', 'margin']],
\ 'renderoptions': [[''], ['xxx']],
\ 'rightleftcmd': [['search'], ['xxx']],
\ 'rulerformat': [['', 'xxx'], ['%-', '%(', '%15(%%']],
+1042 -301
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -749,6 +749,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
321,
/**/
320,
/**/
319,
/**/
318,
/**/
317,
/**/
316,
/**/
315,
/**/