vim-patch:partial:9.2.0573: Vim9: missing EX_WHOLE on some block keywords (#40071)

Problem:  Several Vim9 keywords lack EX_WHOLE and can be shortened in
          Vim9 script, inconsistent with endif/enddef/endfor/endwhile/
          endtry which already have it.  The error from :endd in a
          nested function also hardcodes "enddef" instead of reporting
          what the user typed.  fullcommand("ho") returns "horizontal"
          even though :ho is below the documented 3-char minimum.
Solution: Add EX_WHOLE to :class, :def, :endclass, :endinterface,
          :endenum, :public and :static.  In get_function_body() pass
          the user-typed command to the error message.  Force :ho to
          CMD_SIZE in find_ex_command() so fullcommand() reflects the
          modifier minimum.  Extend tests and documentation accordingly
          (Peter Kenny).

fixes:  vim/vim#20032
closes: vim/vim#20191

38d9a16eba

Co-authored-by: Peter Kenny <github.com@k1w1.cyou>
This commit is contained in:
zeertzjq
2026-06-01 09:04:30 +08:00
committed by GitHub
parent 71a02e261d
commit edcaf1887a
9 changed files with 93 additions and 20 deletions

View File

@@ -3230,9 +3230,16 @@ M.funcs = {
Returns an empty string if a command doesn't exist or if it's
ambiguous (for user-defined commands).
For example `fullcommand('s')`, `fullcommand('sub')`,
`fullcommand(':%substitute')` all return "substitute".
Note: Command validation is not performed. Results depend on
Vim's internal command-specific identification rules.
Examples:
>vim
echo [fullcommand('s')] |" ['substitute']
echo [fullcommand('sub')] |" ['substitute']
echo [fullcommand(': mark word')] |" ['mark']
echo [fullcommand(': markword')] |" ['']
echo [fullcommand('en')] |" ['endif']
<
]=],
name = 'fullcommand',
params = { { 'name', 'string' } },