From 9c04eb02adde4f7daae2c4986ed58037358ce4ad Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 6 Jul 2025 08:41:41 +0800 Subject: vim-patch:9.1.1509: patch 9.1.1505 was not good Problem: Patch 9.1.1505 was not good Solution: Revert "patch 9.1.1505: not possible to return completion type for :ex command" and instead add the getcompletiontype() function (Hirohito Higashi). related: vim/vim#17606 closes: vim/vim#17662 https://github.com/vim/vim/commit/96b3ef23896ce70b2fdf3425ba2c013ce2840db6 Cherry-pick Test_multibyte_expression() from Vim, as it passes. Co-authored-by: Hirohito Higashi Co-authored-by: Shougo Matsushita --- runtime/lua/vim/_meta/vimfn.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'runtime/lua/vim/_meta/vimfn.lua') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 9f82fe41ff..d690eaa34a 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -2994,18 +2994,19 @@ function vim.fn.getcharstr(expr, opts) end --- @return string function vim.fn.getcmdcomplpat() end ---- Return the type of command-line completion using {pat}. ---- If {pat} is omited, only works when the command line is being ---- edited, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. ---- +--- Return the type of the current command-line completion. +--- Only works when the command line is being edited, thus +--- requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. --- See |:command-completion| for the return string. --- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, --- |getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|. --- Returns an empty string when completion is not defined. --- ---- @param pat? string +--- To get the type of the command-line completion for the +--- specified string, use |getcompletiontype()|. +--- --- @return string -function vim.fn.getcmdcompltype(pat) end +function vim.fn.getcmdcompltype() end --- Return the current command-line input. Only works when the --- command line is being edited, thus requires use of @@ -3154,6 +3155,16 @@ function vim.fn.getcmdwintype() end --- @return string[] function vim.fn.getcompletion(pat, type, filtered) end +--- Return the type of the command-line completion using {pat}. +--- When no corresponding completion type is found, an empty +--- string is returned. +--- To get the current command-line completion type, use +--- |getcmdcompltype()|. +--- +--- @param pat string +--- @return string +function vim.fn.getcompletiontype(pat) end + --- Get the position of the cursor. This is like getpos('.'), but --- includes an extra "curswant" item in the list: --- [0, lnum, col, off, curswant] ~ -- cgit