patch 9.1.1250: cannot set the maximum popup menu width Commit: https://github.com/vim/vim/commit/88d75934c3d5bc4c406343f106e1a61638abd3a7 Author: glepnir <glephun...@gmail.com> Date: Thu Mar 27 20:09:07 2025 +0100
patch 9.1.1250: cannot set the maximum popup menu width Problem: cannot set the maximum popup menu width (Lucas Mior) Solution: add the new global option value 'pummaxwidth' (glepnir) fixes: #10901 closes: #16943 Signed-off-by: glepnir <glephun...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 035f6f74f..0b7ba9126 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.1. Last change: 2025 Mar 26 +*options.txt* For Vim version 9.1. Last change: 2025 Mar 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -6476,6 +6476,15 @@ A jump table for the options with a short description can be found at |Q_op|. global 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|. + + *'pummaxwidth'* *'pmw'* +'pummaxwidth' 'pmw' number (default 0) + global + Determines the maximum width to use for the popup menu for completion. + When zero, there is no maximum width limit, otherwise the popup menu + will never be wider than this value. Truncated text will be indicated + by "..." at the end. Takes precedence over 'pumwidth'. |ins-completion-menu|. *'pumwidth'* *'pw'* diff --git a/runtime/doc/tags b/runtime/doc/tags index 5ff06d3f5..75b00aae1 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -843,6 +843,7 @@ $quote eval.txt /*$quote* 'pm' options.txt /*'pm'* 'pmbcs' options.txt /*'pmbcs'* 'pmbfn' options.txt /*'pmbfn'* +'pmw' options.txt /*'pmw'* 'popt' options.txt /*'popt'* 'pp' options.txt /*'pp'* 'preserveindent' options.txt /*'preserveindent'* @@ -860,6 +861,7 @@ $quote eval.txt /*$quote* 'prompt' options.txt /*'prompt'* 'pt' options.txt /*'pt'* 'pumheight' options.txt /*'pumheight'* +'pummaxwidth' options.txt /*'pummaxwidth'* 'pumwidth' options.txt /*'pumwidth'* 'pvh' options.txt /*'pvh'* 'pvp' options.txt /*'pvp'* diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 5868598be..0e9a5080f 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -1,4 +1,4 @@ -*version9.txt* For Vim version 9.1. Last change: 2025 Mar 26 +*version9.txt* For Vim version 9.1. Last change: 2025 Mar 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -41627,6 +41627,7 @@ Options: ~ - 'rulerformat' now supports the |stl-%!| item - use 'smoothscroll' logic for CTRL-F / CTRL-B for pagewise scrolling and CTRL-D / CTRL-U for half-pagewise scrolling +- 'pummaxwidth' maximum width for the completion popup menu Ex commands: ~ - allow to specify a priority when defining a new sign |:sign-define| diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 9d8ac7645..9b5921171 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: The Vim Project <https://github.com/vim/vim> -" Last Change: 2025 Mar 07 +" Last Change: 2025 Mar 27 " Former Maintainer: Bram Moolenaar <b...@vim.org> " If there already is an option window, jump to that one. @@ -863,6 +863,8 @@ if has("insert_expand") call <SID>OptionG("ph", &ph) call <SID>AddOption("pumwidth", gettext("minimum width of the popup menu")) call <SID>OptionG("pw", &pw) + call <SID>AddOption("pumaxmwidth", gettext("maximum width of the popup menu")) + call <SID>OptionG("pmw", &pmw) call <SID>AddOption("completefunc", gettext("user defined function for Insert mode completion")) call append("$", " " .. s:local_to_buffer) call <SID>OptionL("cfu") diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 502713807..fc8e0589f 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com> " Doug Kearns <dougkea...@gmail.com> -" Last Change: 2025 Mar 26 +" Last Change: 2025 Mar 27 " Former Maintainer: Charles E. Campbell " DO NOT CHANGE DIRECTLY. @@ -51,10 +51,10 @@ syn keyword vimOption contained al aleph ari allowrevins ambw ambiwidth arab ara syn keyword vimOption contained cfc completefuzzycollect cia completeitemalign cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore eiw eventignorewin et expandtab ex exrc fenc fileencoding skipwhite nextgroup=vimSetEqual,vimSetMod syn keyword vimOption contained 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 hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring ic ignorecase imaf imactivatefunc imak imactivatekey skipwhite nextgroup=vimSetEqual,vimSetMod syn keyword vimOption contained 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 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 mmd maxmapdepth mm maxmem mmp maxmempattern mmt maxmemtot mis menuitems mopt messagesopt msm mkspellmem ml modeline skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 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 popt printoptions prompt ph pumheight pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc qe quoteescape skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent sta smarttab skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors 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 skipwhite nextgroup=vimSetEqual,vimSetMod -syn keyword vimOption contained 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 wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight wmw winminwidth winptydll wiw winwidth wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay xtermcodes skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 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 popt printoptions prompt ph pumheight pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion qftf quickfixtextfunc skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline ss sidescroll siso sidescrolloff scl signcolumn scs smartcase si smartindent skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors 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 skipwhite nextgroup=vimSetEqual,vimSetMod +syn keyword vimOption contained 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 wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight wmw winminwidth winptydll wiw winwidth 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='' @@ -89,11 +89,11 @@ syn keyword vimOptionVarName contained al aleph ari allowrevins ambw ambiwidth a syn keyword vimOptionVarName contained cfc completefuzzycollect cia completeitemalign cot completeopt cpp completepopup csl completeslash cocu concealcursor cole conceallevel cf confirm ci copyindent cpo cpoptions cm cryptmethod cspc cscopepathcomp csprg cscopeprg csqf cscopequickfix csre cscoperelative cst cscopetag csto cscopetagorder csverb cscopeverbose crb cursorbind cuc cursorcolumn cul cursorline culopt cursorlineopt debug def define deco delcombine dict dictionary diff dex diffexpr dip diffopt dg digraph dir directory dy display ead eadirection ed edcompatible emo emoji enc encoding eof endoffile eol endofline ea equalalways ep equalprg eb errorbells ef errorfile efm errorformat ek esckeys ei eventignore eiw eventignorewin et expandtab ex exrc fenc fileencoding syn keyword vimOptionVarName contained 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 hi history hk hkmap hkp hkmapp hls hlsearch icon iconstring ic ignorecase imaf imactivatefunc syn keyword vimOptionVarName contained 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 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 mmd maxmapdepth mm maxmem mmp maxmempattern mmt maxmemtot mis menuitems mopt messagesopt -syn keyword vimOptionVarName contained 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 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 popt printoptions prompt ph pumheight pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome pyx pyxversion -syn keyword vimOptionVarName contained 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 sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline ss sidescroll siso sidescrolloff scl signcolumn -syn keyword vimOptionVarName contained 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 su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors 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 -syn keyword vimOptionVarName contained 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 wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight wmw winminwidth winptydll wiw winwidth wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup wd writedelay -syn keyword vimOptionVarName contained xtermcodes +syn keyword vimOptionVarName contained 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 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 popt printoptions prompt ph pumheight pmw pummaxwidth pw pumwidth pythondll pythonhome pythonthreedll pythonthreehome +syn keyword vimOptionVarName contained 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 sc showcmd sloc showcmdloc sft showfulltag sm showmatch smd showmode stal showtabline ss sidescroll siso sidescrolloff +syn keyword vimOptionVarName contained 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 su suffixes sua suffixesadd swf swapfile sws swapsync swb switchbuf smc synmaxcol syn syntax tcl tabclose tal tabline tpm tabpagemax ts tabstop tbs tagbsearch tc tagcase tfu tagfunc tl taglength tr tagrelative tag tags tgst tagstack tcldll term tbidi termbidi tenc termencoding tgc termguicolors 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 +syn keyword vimOptionVarName contained 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 wi window wfb winfixbuf wfh winfixheight wfw winfixwidth wh winheight wmh winminheight wmw winminwidth winptydll wiw winwidth wrap wm wrapmargin ws wrapscan write wa writeany wb writebackup +syn keyword vimOptionVarName contained 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 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 diff --git a/src/option.h b/src/option.h index 5714e0c4f..0b568f193 100644 --- a/src/option.h +++ b/src/option.h @@ -545,6 +545,7 @@ EXTERN char_u *p_csl; // 'completeslash' #endif EXTERN long p_ph; // 'pumheight' EXTERN long p_pw; // 'pumwidth' +EXTERN long p_pmw; // 'pummaxwidth' EXTERN char_u *p_com; // 'comments' EXTERN char_u *p_cpo; // 'cpoptions' #ifdef FEAT_CSCOPE diff --git a/src/optiondefs.h b/src/optiondefs.h index 3621635c1..b6b5d49eb 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -2021,6 +2021,9 @@ static struct vimoption options[] = {"pumheight", "ph", P_NUM|P_VI_DEF, (char_u *)&p_ph, PV_NONE, NULL, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, + {"pummaxwidth", "pmw", P_NUM|P_VI_DEF, + (char_u *)&p_pmw, PV_NONE, NULL, NULL, + {(char_u *)0L, (char_u *)0L} 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}, diff --git a/src/popupmenu.c b/src/popupmenu.c index 443223de7..d69c7bd84 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -115,6 +115,8 @@ pum_display( do { def_width = p_pw; + if (p_pmw > 0 && def_width > p_pmw) + def_width = p_pmw; above_row = 0; below_row = cmdline_row; @@ -226,6 +228,8 @@ pum_display( pum_size = size; pum_compute_size(); max_width = pum_base_width; + if (p_pmw > 0 && max_width > p_pmw) + max_width = p_pmw; // Calculate column if (State == MODE_CMDLINE) @@ -275,8 +279,12 @@ pum_display( content_width = max_width + pum_kind_width + pum_extra_width + 1; if (pum_width > content_width && pum_width > p_pw) + { // Reduce width to fit item - pum_width = MAX(content_width , p_pw); + pum_width = MAX(content_width, p_pw); + if (p_pmw > 0 && pum_width > p_pmw) + pum_width = p_pmw; + } else if (((cursor_col > p_pw || cursor_col > max_width) #ifdef FEAT_RIGHTLEFT && !pum_rl) @@ -313,6 +321,8 @@ pum_display( if (pum_width < p_pw) { pum_width = p_pw; + if (p_pmw > 0 && pum_width > p_pmw) + pum_width = p_pmw; #ifdef FEAT_RIGHTLEFT if (pum_rl) { @@ -327,7 +337,11 @@ pum_display( } } else if (pum_width > content_width && pum_width > p_pw) + { pum_width = MAX(content_width, p_pw); + if (p_pmw > 0 && pum_width > p_pmw) + pum_width = p_pmw; + } } } @@ -341,11 +355,15 @@ pum_display( #endif pum_col = 0; pum_width = Columns - 1; + if (p_pmw > 0 && pum_width > p_pmw) + pum_width = p_pmw; } else { if (max_width > p_pw) max_width = p_pw; // truncate + if (p_pmw > 0 && max_width > p_pmw) + max_width = p_pmw; #ifdef FEAT_RIGHTLEFT if (pum_rl) pum_col = max_width - 1; @@ -582,6 +600,13 @@ pum_redraw(void) int last_isabbr = FALSE; int orig_attr = -1; int scroll_range = pum_size - pum_height; + int need_ellipsis = FALSE; + int char_cells = 0; + int ellipsis_width = 3; + int over_cell = 0; + char_u *new_str = NULL; + int kept_len = 0; + char_u *last_char = NULL; hlf_T hlfsNorm[3]; hlf_T hlfsSel[3]; @@ -698,8 +723,14 @@ pum_redraw(void) { char_u *rt_start = rt; int cells; + int used_cells = 0; + char_u *old_rt = NULL; + char_u *orig_rt = NULL; cells = vim_strsize(rt); + need_ellipsis = p_pmw > ellipsis_width + && pum_width == p_pmw + && cells > pum_width; if (cells > pum_width) { do @@ -709,7 +740,42 @@ pum_redraw(void) MB_PTR_ADV(rt); } while (cells > pum_width); - if (cells < pum_width) + if (need_ellipsis) + { + orig_rt = rt; + while (*orig_rt != NUL) + { + char_cells = has_mbyte ? (*mb_ptr2cells)(orig_rt) : 1; + if (used_cells + char_cells > ellipsis_width) + break; + used_cells += char_cells; + MB_PTR_ADV(orig_rt); + last_char = orig_rt; + } + + if (last_char != NULL) + { + if (used_cells < ellipsis_width) + { + over_cell = ellipsis_width - used_cells; + MB_PTR_ADV(orig_rt); + last_char = orig_rt; + } + kept_len = STRLEN(last_char); + new_str = alloc(ellipsis_width + over_cell + kept_len + 1); + if (!new_str) + return; + vim_memset(new_str, '.', ellipsis_width); + if (over_cell > 0) + vim_memset(new_str + ellipsis_width, ' ', over_cell); + memcpy(new_str + ellipsis_width + over_cell, last_char, kept_len); + new_str[ellipsis_width + kept_len + over_cell] = NUL; + old_rt = rt_start; + rt = rt_start = new_str; + vim_free(old_rt); + } + } + else if (cells < pum_width) { // Most left character requires 2-cells // but only 1 cell is available on @@ -739,8 +805,13 @@ pum_redraw(void) { if (st != NULL) { - int size = (int)STRLEN(st); - int cells = (*mb_string2cells)(st, size); + int size = (int)STRLEN(st); + int cells = (*mb_string2cells)(st, size); + int used_cells = 0; + char_u *st_end = NULL; + need_ellipsis = p_pmw > ellipsis_width + && pum_width == p_pmw + && col + cells > pum_col + pum_width; // only draw the text that fits while (size > 0 @@ -756,6 +827,42 @@ pum_redraw(void) --cells; } + // Add '...' indicator if truncated due to p_pmw + if (need_ellipsis) + { + st_end = st + size; + while (st_end > st) + { + char_cells = has_mbyte ? (*mb_ptr2cells)(st_end) : 1; + if (used_cells + char_cells > ellipsis_width) + break; + used_cells += char_cells; + MB_PTR_BACK(st, st_end); + last_char = st_end; + } + + if (last_char != NULL) + { + if (used_cells < ellipsis_width) + { + MB_PTR_BACK(st, st_end); + last_char = st_end; + over_cell = ellipsis_width - used_cells; + } + kept_len = last_char - st; + new_str = alloc(ellipsis_width + over_cell + kept_len + 1); + if (!new_str) + return; + memcpy(new_str, st, kept_len); + if (over_cell > 0) + vim_memset(new_str + kept_len, ' ', over_cell); + vim_memset(new_str + kept_len + over_cell, '.', ellipsis_width); + new_str[kept_len + ellipsis_width + over_cell] = NUL; + vim_free(st); + st = new_str; + } + } + if (attrs == NULL) screen_puts_len(st, size, row, col, attr); else diff --git a/src/testdir/dumps/Test_pum_maxwidth_01.dump b/src/testdir/dumps/Test_pum_maxwidth_01.dump new file mode 100644 index 000000000..a836ab0ac --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_01.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @43 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @43 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a> @31 +|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| | +0#4040ff13#ffffff0@30 +|~| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| | +0#4040ff13#ffffff0@30 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/dumps/Test_pum_maxwidth_02.dump b/src/testdir/dumps/Test_pum_maxwidth_02.dump new file mode 100644 index 000000000..427ea9f64 --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_02.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @43 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @43 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a> @31 +|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|.@2| +0#4040ff13#ffffff0@52 +|~| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|.@2| +0#4040ff13#ffffff0@52 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/dumps/Test_pum_maxwidth_03.dump b/src/testdir/dumps/Test_pum_maxwidth_03.dump new file mode 100644 index 000000000..e30310827 --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_03.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @43 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @43 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a> @31 +|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|.@2| +0#4040ff13#ffffff0@42 +|~| @9| +0#0000001#ffd7ff255|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|.@2| +0#4040ff13#ffffff0@42 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/dumps/Test_pum_maxwidth_04.dump b/src/testdir/dumps/Test_pum_maxwidth_04.dump new file mode 100644 index 000000000..a6d257ec1 --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_04.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a| @43 +|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|b| @43 +@12|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|a> @31 +|~+0#4040ff13&| @9| +0#0000001#e0e0e08|1|2|3|4|5|.@2| +0#4040ff13#ffffff0@54 +|~| @9| +0#0000001#ffd7ff255|1|2|3|4|5|.@2| +0#4040ff13#ffffff0@54 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/dumps/Test_pum_maxwidth_05.dump b/src/testdir/dumps/Test_pum_maxwidth_05.dump new file mode 100644 index 000000000..0dd6a3937 --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_05.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_> @44 +|1+0#0000001#e0e0e08|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_| | +0#4040ff13#ffffff0@43 +|一*0#0000001#ffd7ff255|二|三|四|五|六|七|八|九|十| +&@10| +0#4040ff13#ffffff0@43 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/dumps/Test_pum_maxwidth_06.dump b/src/testdir/dumps/Test_pum_maxwidth_06.dump new file mode 100644 index 000000000..7321870eb --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_06.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_> @44 +|1+0#0000001#e0e0e08|2|3|4|5|6|7|.@2| +0#4040ff13#ffffff0@64 +|一*0#0000001#ffd7ff255|二|三| +&|.@2| +0#4040ff13#ffffff0@64 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/dumps/Test_pum_maxwidth_07.dump b/src/testdir/dumps/Test_pum_maxwidth_07.dump new file mode 100644 index 000000000..8e81d31b9 --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_07.dump @@ -0,0 +1,8 @@ +| +0&#ffffff0@43> |_|9|8|7|6|5|4|3|2|1|_|9|8|7|6|5|4|3|2|1|_|9|8|7|6|5|4|3|2|1 +| +0#4040ff13&@64|.+0#0000001#e0e0e08@2|7|6|5|4|3|2|1 +| +0#4040ff13#ffffff0@64|.+0#0000001#ffd7ff255@2| |三*&|二|一 +| +0#4040ff13#ffffff0@73|~ +| @73|~ +| @73|~ +| @73|~ +| @73|~ diff --git a/src/testdir/dumps/Test_pum_maxwidth_08.dump b/src/testdir/dumps/Test_pum_maxwidth_08.dump new file mode 100644 index 000000000..8681e5f69 --- /dev/null +++ b/src/testdir/dumps/Test_pum_maxwidth_08.dump @@ -0,0 +1,8 @@ +|1+0&#ffffff0|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_|1|2|3|4|5|6|7|8|9|_> @44 +|1+0#0000001#e0e0e08|2| +0#4040ff13#ffffff0@72 +|一*0#0000001#ffd7ff255| +0#4040ff13#ffffff0@72 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index e599a8d0a..94839b5b7 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -1986,4 +1986,81 @@ func Test_pum_complete_with_special_characters() call StopVimInTerminal(buf) endfunc +func Test_pum_maxwidth() + CheckScreendump + + let lines =<< trim END + 123456789_123456789_123456789_a + 123456789_123456789_123456789_b + 123 + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('Xtest', {}) + + call term_sendkeys(buf, "G\"zyy") + call term_sendkeys(buf, "A\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_01', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set pummaxwidth=10\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_02', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set pummaxwidth=20\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_03', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call term_sendkeys(buf, ":set pumwidth=20 pummaxwidth=8\<CR>") + call term_sendkeys(buf, "GA\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_04', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>3Gdd\"zp") + + call StopVimInTerminal(buf) +endfunc + +func Test_pum_maxwidth_multibyte() + CheckScreendump + + let lines =<< trim END + func Omni_test(findstart, base) + if a:findstart + return col(".") + endif + return [ + \ #{word: "123456789_123456789_123456789_"}, + \ #{word: "一二三四五六七八九十"}, + \ ] + endfunc + set omnifunc=Omni_test + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('-S Xtest', {}) + call TermWait(buf) + + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_05', {'rows': 8}) + call term_sendkeys(buf, "\<ESC>") + + call term_sendkeys(buf, ":set pummaxwidth=10\<CR>") + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_06', {'rows': 8}) + call term_sendkeys(buf, "\<ESC>") + + if has('rightleft') + call term_sendkeys(buf, ":set rightleft\<CR>") + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_07', {'rows': 8}) + call term_sendkeys(buf, "\<Esc>:set norightleft\<CR>") + endif + + call term_sendkeys(buf, ":set pummaxwidth=2\<CR>") + call term_sendkeys(buf, "S\<C-X>\<C-O>") + call VerifyScreenDump(buf, 'Test_pum_maxwidth_08', {'rows': 8}) + call term_sendkeys(buf, "\<ESC>") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 7339d58f2..cb559cfd8 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1250, /**/ 1249, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1txsgx-001mB7-VV%40256bit.org.