patch 9.1.1509: patch 9.1.1505 was not good

Commit: 
https://github.com/vim/vim/commit/96b3ef23896ce70b2fdf3425ba2c013ce2840db6
Author: Hirohito Higashi <h.east....@gmail.com>
Date:   Sat Jul 5 15:31:23 2025 +0200

    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: #17606
    closes: #17662
    
    Co-authored-by: Shougo Matsushita <shougo.ma...@gmail.com>
    Signed-off-by: Hirohito Higashi <h.east....@gmail.com>
    Signed-off-by: Shougo Matsushita <shougo.ma...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 8f9c7baa2..f38948c75 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1,4 +1,4 @@
-*builtin.txt*  For Vim version 9.1.  Last change: 2025 Jul 03
+*builtin.txt*  For Vim version 9.1.  Last change: 2025 Jul 05
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -238,8 +238,8 @@ getcharsearch()                     Dict    last character 
search
 getcharstr([{expr} [, {opts}]])        String  get one character from the user
 getcmdcomplpat()               String  return the completion pattern of the
                                        current command-line completion
-getcmdcompltype({pat})         String  return the type of command-line
-                                       completion
+getcmdcompltype()              String  return the type of the current
+                                       command-line completion
 getcmdline()                   String  return the current command-line input
 getcmdpos()                    Number  return cursor position in command-line
 getcmdprompt()                 String  return the current command-line prompt
@@ -249,6 +249,8 @@ getcmdtype()                        String  return current 
command-line type
 getcmdwintype()                        String  return current command-line 
window type
 getcompletion({pat}, {type} [, {filtered}])
                                List    list of cmdline completion matches
+getcompletiontype({pat})       String  return the type of the command-line
+                                       completion using {pat}
 getcurpos([{winnr}])           List    position of the cursor
 getcursorcharpos([{winnr}])    List    character position of the cursor
 getcwd([{winnr} [, {tabnr}]])  String  get the current working directory
@@ -4201,16 +4203,18 @@ getcmdcomplpat()                                        
*getcmdcomplpat()*
                Return type: |String|
 
 
-getcmdcompltype([{pat}])                               *getcmdcompltype()*
-               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_=|.
-
+getcmdcompltype()                                      *getcmdcompltype()*
+               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.
 
+               To get the type of the command-line completion for the
+               specified string, use |getcompletiontype()|.
+
                Return type: |String|
 
 
@@ -4369,6 +4373,15 @@ getcompletion({pat}, {type} [, {filtered}])              
*getcompletion()*
 <
                Return type: list<string>
 
+getcompletiontype({pat})                               *getcompletiontype()*
+               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()|.
+
+               Return type: |String|
+
                                                        *getcurpos()*
 getcurpos([{winid}])
                Get the position of the cursor.  This is like getpos('.'), but
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 6b363dbaa..3f83210b4 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -7976,6 +7976,7 @@ getcmdscreenpos() builtin.txt     /*getcmdscreenpos()*
 getcmdtype()   builtin.txt     /*getcmdtype()*
 getcmdwintype()        builtin.txt     /*getcmdwintype()*
 getcompletion()        builtin.txt     /*getcompletion()*
+getcompletiontype()    builtin.txt     /*getcompletiontype()*
 getcurpos()    builtin.txt     /*getcurpos()*
 getcursorcharpos()     builtin.txt     /*getcursorcharpos()*
 getcwd()       builtin.txt     /*getcwd()*
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 9b8cdc2be..02d58f0d8 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt*   For Vim version 9.1.  Last change: 2025 Jul 03
+*usr_41.txt*   For Vim version 9.1.  Last change: 2025 Jul 05
 
                     VIM USER MANUAL - by Bram Moolenaar
 
@@ -1100,7 +1100,8 @@ Buffers, windows and the argument list:
 Command line:                                  *command-line-functions*
        getcmdcomplpat()        get completion pattern of the current command
                                line
-       getcmdcompltype()       get the type of the command line completion
+       getcmdcompltype()       get the type of the current command line
+                               completion
        getcmdline()            get the current command line input
        getcmdprompt()          get the current command line prompt
        getcmdpos()             get position of the cursor in the command line
@@ -1111,6 +1112,8 @@ Command line:                                     
*command-line-functions*
        getcmdtype()            return the current command-line type
        getcmdwintype()         return the current command-line window type
        getcompletion()         list of command-line completion matches
+       getcompletiontype()     get the type of the command-line completion
+                               for specified string
        fullcommand()           get full command name
        cmdcomplete_info()      get command-line completion information
 
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 75d14011a..f53399587 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 Jul 03
+*version9.txt*  For Vim version 9.1.  Last change: 2025 Jul 05
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41607,8 +41607,6 @@ Completion: ~
 - allow to complete directories from 'cdpath' for |:cd| and similar commands,
   add the "cd_in_path" completion type for e.g. |:command-complete| and
   |getcompletion()|
-- |getcompletion()| now accepts a pat and returns the completion type for the
-  {pat} argument
 - allow to complete shell commands and files using the new shellcmdline
   completion type using |:command-complete| and |getcmdcomplpat()|
 - allow to specify additional attributes in the completion menu (allows to
@@ -41713,6 +41711,7 @@ Functions: ~
 |getcellpixels()|      get List of terminal cell pixel size
 |getcmdcomplpat()|     Shell command line completion
 |getcmdprompt()|       get prompt for input()/confirm()
+|getcompletiontype()|  get command-line completion type
 |getregion()|          get a region of text from a buffer
 |getregionpos()|       get a list of positions for a region
 |getstacktrace()|      get current stack trace of Vim scripts
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 528706fdb..e04429eb0 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 Jul 04
+" Last Change:    2025 Jul 05
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -142,13 +142,13 @@ syn case match
 " GEN_SYN_VIM: vimFuncName, START_STR='syn keyword vimFuncName contained', 
END_STR=''
 syn keyword vimFuncName contained abs acos add and append appendbufline argc 
argidx arglistid argv asin assert_beeps assert_equal assert_equalfile 
assert_exception assert_fails assert_false assert_inrange assert_match 
assert_nobeep assert_notequal assert_notmatch assert_report assert_true atan 
atan2 autocmd_add autocmd_delete autocmd_get balloon_gettext balloon_show 
balloon_split base64_decode base64_encode bindtextdomain blob2list blob2str 
browse browsedir bufadd bufexists buflisted bufload bufloaded bufname bufnr 
bufwinid bufwinnr byte2line byteidx byteidxcomp call ceil ch_canread ch_close 
ch_close_in ch_evalexpr ch_evalraw ch_getbufnr ch_getjob ch_info ch_log 
ch_logfile ch_open ch_read ch_readblob ch_readraw ch_sendexpr ch_sendraw 
ch_setoptions ch_status changenr
 syn keyword vimFuncName contained char2nr charclass charcol charidx chdir 
cindent clearmatches cmdcomplete_info col complete complete_add complete_check 
complete_info complete_match confirm copy cos cosh count cscope_connection 
cursor debugbreak deepcopy delete deletebufline did_filetype diff diff_filler 
diff_hlID digraph_get digraph_getlist digraph_set digraph_setlist echoraw empty 
environ err_teapot escape eval eventhandler executable execute exepath exists 
exists_compiled exp expand expandcmd extend extendnew feedkeys filecopy 
filereadable filewritable filter finddir findfile flatten flattennew float2nr 
floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext 
foldtextresult foreach foreground fullcommand funcref function garbagecollect
-syn keyword vimFuncName contained get getbufinfo getbufline getbufoneline 
getbufvar getcellpixels getcellwidths getchangelist getchar getcharmod 
getcharpos getcharsearch getcharstr getcmdcomplpat getcmdcompltype getcmdline 
getcmdpos getcmdprompt getcmdscreenpos getcmdtype getcmdwintype getcompletion 
getcurpos getcursorcharpos getcwd getenv getfontname getfperm getfsize getftime 
getftype getimstatus getjumplist getline getloclist getmarklist getmatches 
getmousepos getmouseshape getpid getpos getqflist getreg getreginfo getregion 
getregionpos getregtype getscriptinfo getstacktrace gettabinfo gettabvar 
gettabwinvar gettagstack gettext getwininfo getwinpos getwinposx getwinposy 
getwinvar glob glob2regpat globpath has has_key haslocaldir hasmapto histadd 
histdel histget
-syn keyword vimFuncName contained histnr hlID hlexists hlget hlset hostname 
iconv id indent index indexof input inputdialog inputlist inputrestore 
inputsave inputsecret insert instanceof interrupt invert isabsolutepath 
isdirectory isinf islocked isnan items job_getchannel job_info job_setoptions 
job_start job_status job_stop join js_decode js_encode json_decode json_encode 
keys keytrans len libcall libcallnr line line2byte lispindent list2blob 
list2str list2tuple listener_add listener_flush listener_remove localtime log 
log10 luaeval map maparg mapcheck maplist mapnew mapset match matchadd 
matchaddpos matcharg matchbufline matchdelete matchend matchfuzzy matchfuzzypos 
matchlist matchstr matchstrlist matchstrpos max menu_info min mkdir mode mzeval 
nextnonblank
-syn keyword vimFuncName contained ngettext nr2char or pathshorten perleval 
popup_atcursor popup_beval popup_clear popup_close popup_create popup_dialog 
popup_filter_menu popup_filter_yesno popup_findecho popup_findinfo 
popup_findpreview popup_getoptions popup_getpos popup_hide popup_list 
popup_locate popup_menu popup_move popup_notification popup_setbuf 
popup_setoptions popup_settext popup_show pow prevnonblank printf 
prompt_getprompt prompt_setcallback prompt_setinterrupt prompt_setprompt 
prop_add prop_add_list prop_clear prop_find prop_list prop_remove prop_type_add 
prop_type_change prop_type_delete prop_type_get prop_type_list pum_getpos 
pumvisible py3eval pyeval pyxeval rand range readblob readdir readdirex 
readfile reduce reg_executing reg_recording reltime
-syn keyword vimFuncName contained reltimefloat reltimestr remote_expr 
remote_foreground remote_peek remote_read remote_send remote_startserver remove 
rename repeat resolve reverse round rubyeval screenattr screenchar screenchars 
screencol screenpos screenrow screenstring search searchcount searchdecl 
searchpair searchpairpos searchpos server2client serverlist setbufline 
setbufvar setcellwidths setcharpos setcharsearch setcmdline setcmdpos 
setcursorcharpos setenv setfperm setline setloclist setmatches setpos setqflist 
setreg settabvar settabwinvar settagstack setwinvar sha256 shellescape 
shiftwidth sign_define sign_getdefined sign_getplaced sign_jump sign_place 
sign_placelist sign_undefine sign_unplace sign_unplacelist simplify sin sinh 
slice sort sound_clear sound_playevent
-syn keyword vimFuncName contained sound_playfile sound_stop soundfold 
spellbadword spellsuggest split sqrt srand state str2blob str2float str2list 
str2nr strcharlen strcharpart strchars strdisplaywidth strftime strgetchar 
stridx string strlen strpart strptime strridx strtrans strutf16len strwidth 
submatch substitute swapfilelist swapinfo swapname synID synIDattr synIDtrans 
synconcealed synstack system systemlist tabpagebuflist tabpagenr tabpagewinnr 
tagfiles taglist tan tanh tempname term_dumpdiff term_dumpload term_dumpwrite 
term_getaltscreen term_getansicolors term_getattr term_getcursor term_getjob 
term_getline term_getscrolled term_getsize term_getstatus term_gettitle 
term_gettty term_list term_scrape term_sendkeys term_setansicolors term_setapi 
term_setkill
-syn keyword vimFuncName contained term_setrestore term_setsize term_start 
term_wait terminalprops test_alloc_fail test_autochdir test_feedinput 
test_garbagecollect_now test_garbagecollect_soon test_getvalue test_gui_event 
test_ignore_error test_mswin_event test_null_blob test_null_channel 
test_null_dict test_null_function test_null_job test_null_list 
test_null_partial test_null_string test_null_tuple test_option_not_set 
test_override test_refcount test_setmouse test_settime test_srand_seed 
test_unknown test_void timer_info timer_pause timer_start timer_stop 
timer_stopall tolower toupper tr trim trunc tuple2list type typename undofile 
undotree uniq utf16idx values virtcol virtcol2col visualmode wildmenumode 
win_execute win_findbuf win_getid win_gettype win_gotoid
-syn keyword vimFuncName contained win_id2tabwin win_id2win win_move_separator 
win_move_statusline win_screenpos win_splitmove winbufnr wincol windowsversion 
winheight winlayout winline winnr winrestcmd winrestview winsaveview winwidth 
wordcount writefile xor
+syn keyword vimFuncName contained get getbufinfo getbufline getbufoneline 
getbufvar getcellpixels getcellwidths getchangelist getchar getcharmod 
getcharpos getcharsearch getcharstr getcmdcomplpat getcmdcompltype getcmdline 
getcmdpos getcmdprompt getcmdscreenpos getcmdtype getcmdwintype getcompletion 
getcompletiontype getcurpos getcursorcharpos getcwd getenv getfontname getfperm 
getfsize getftime getftype getimstatus getjumplist getline getloclist 
getmarklist getmatches getmousepos getmouseshape getpid getpos getqflist getreg 
getreginfo getregion getregionpos getregtype getscriptinfo getstacktrace 
gettabinfo gettabvar gettabwinvar gettagstack gettext getwininfo getwinpos 
getwinposx getwinposy getwinvar glob glob2regpat globpath has has_key 
haslocaldir hasmapto
+syn keyword vimFuncName contained histadd histdel histget histnr hlID hlexists 
hlget hlset hostname iconv id indent index indexof input inputdialog inputlist 
inputrestore inputsave inputsecret insert instanceof interrupt invert 
isabsolutepath isdirectory isinf islocked isnan items job_getchannel job_info 
job_setoptions job_start job_status job_stop join js_decode js_encode 
json_decode json_encode keys keytrans len libcall libcallnr line line2byte 
lispindent list2blob list2str list2tuple listener_add listener_flush 
listener_remove localtime log log10 luaeval map maparg mapcheck maplist mapnew 
mapset match matchadd matchaddpos matcharg matchbufline matchdelete matchend 
matchfuzzy matchfuzzypos matchlist matchstr matchstrlist matchstrpos max 
menu_info min mkdir mode
+syn keyword vimFuncName contained mzeval nextnonblank ngettext nr2char or 
pathshorten perleval popup_atcursor popup_beval popup_clear popup_close 
popup_create popup_dialog popup_filter_menu popup_filter_yesno popup_findecho 
popup_findinfo popup_findpreview popup_getoptions popup_getpos popup_hide 
popup_list popup_locate popup_menu popup_move popup_notification popup_setbuf 
popup_setoptions popup_settext popup_show pow prevnonblank printf 
prompt_getprompt prompt_setcallback prompt_setinterrupt prompt_setprompt 
prop_add prop_add_list prop_clear prop_find prop_list prop_remove prop_type_add 
prop_type_change prop_type_delete prop_type_get prop_type_list pum_getpos 
pumvisible py3eval pyeval pyxeval rand range readblob readdir readdirex 
readfile reduce reg_executing
+syn keyword vimFuncName contained reg_recording reltime reltimefloat 
reltimestr remote_expr remote_foreground remote_peek remote_read remote_send 
remote_startserver remove rename repeat resolve reverse round rubyeval 
screenattr screenchar screenchars screencol screenpos screenrow screenstring 
search searchcount searchdecl searchpair searchpairpos searchpos server2client 
serverlist setbufline setbufvar setcellwidths setcharpos setcharsearch 
setcmdline setcmdpos setcursorcharpos setenv setfperm setline setloclist 
setmatches setpos setqflist setreg settabvar settabwinvar settagstack setwinvar 
sha256 shellescape shiftwidth sign_define sign_getdefined sign_getplaced 
sign_jump sign_place sign_placelist sign_undefine sign_unplace sign_unplacelist 
simplify sin sinh slice
+syn keyword vimFuncName contained sort sound_clear sound_playevent 
sound_playfile sound_stop soundfold spellbadword spellsuggest split sqrt srand 
state str2blob str2float str2list str2nr strcharlen strcharpart strchars 
strdisplaywidth strftime strgetchar stridx string strlen strpart strptime 
strridx strtrans strutf16len strwidth submatch substitute swapfilelist swapinfo 
swapname synID synIDattr synIDtrans synconcealed synstack system systemlist 
tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh tempname 
term_dumpdiff term_dumpload term_dumpwrite term_getaltscreen term_getansicolors 
term_getattr term_getcursor term_getjob term_getline term_getscrolled 
term_getsize term_getstatus term_gettitle term_gettty term_list term_scrape 
term_sendkeys term_setansicolors
+syn keyword vimFuncName contained term_setapi term_setkill term_setrestore 
term_setsize term_start term_wait terminalprops test_alloc_fail test_autochdir 
test_feedinput test_garbagecollect_now test_garbagecollect_soon test_getvalue 
test_gui_event test_ignore_error test_mswin_event test_null_blob 
test_null_channel test_null_dict test_null_function test_null_job 
test_null_list test_null_partial test_null_string test_null_tuple 
test_option_not_set test_override test_refcount test_setmouse test_settime 
test_srand_seed test_unknown test_void timer_info timer_pause timer_start 
timer_stop timer_stopall tolower toupper tr trim trunc tuple2list type typename 
undofile undotree uniq utf16idx values virtcol virtcol2col visualmode 
wildmenumode win_execute win_findbuf win_getid
+syn keyword vimFuncName contained win_gettype win_gotoid win_id2tabwin 
win_id2win win_move_separator win_move_statusline win_screenpos win_splitmove 
winbufnr wincol windowsversion winheight winlayout winline winnr winrestcmd 
winrestview winsaveview winwidth wordcount writefile xor
 " Predefined variable names {{{2
 " GEN_SYN_VIM: vimVarName, START_STR='syn keyword vimVimVarName contained', 
END_STR=''
 syn keyword vimVimVarName contained count count1 prevcount errmsg warningmsg 
statusmsg shell_error this_session version lnum termresponse fname lang lc_time 
ctype charconvert_from charconvert_to fname_in fname_out fname_new fname_diff 
cmdarg foldstart foldend folddashes foldlevel progname servername dying 
exception throwpoint register cmdbang insertmode val key profiling fcs_reason 
fcs_choice beval_bufnr beval_winnr beval_winid beval_lnum beval_col beval_text 
scrollstart swapname swapchoice swapcommand char mouse_win mouse_winid 
mouse_lnum mouse_col operator searchforward hlsearch oldfiles windowid progpath 
completed_item option_new option_old option_oldlocal option_oldglobal 
option_command option_type errors false true none null numbermax numbermin 
numbersize
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index f7a5f5cc6..b1c9ed67a 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -4556,6 +4556,35 @@ f_getcompletion(typval_T *argvars, typval_T *rettv)
     ExpandCleanup(&xpc);
 }
 
+/*
+ * "getcompletiontype()" function
+ */
+    void
+f_getcompletiontype(typval_T *argvars, typval_T *rettv)
+{
+    char_u     *pat;
+    expand_T   xpc;
+    int                cmdline_len;
+
+    rettv->v_type = VAR_STRING;
+    rettv->vval.v_string = NULL;
+
+    if (check_for_string_arg(argvars, 0) == FAIL)
+       return;
+
+    pat = tv_get_string(&argvars[0]);
+    ExpandInit(&xpc);
+
+    cmdline_len = (int)STRLEN(pat);
+    set_cmd_context(&xpc, pat, cmdline_len, cmdline_len, FALSE);
+    xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
+    xpc.xp_col = cmdline_len;
+
+    rettv->vval.v_string = get_cmdline_completion(&xpc);
+
+    ExpandCleanup(&xpc);
+}
+
 /*
  * "cmdcomplete_info()" function
  */
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 6ba698d56..ec21087e2 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2264,7 +2264,7 @@ static funcentry_T global_functions[] =
                        ret_string,         f_getcharstr},
     {"getcmdcomplpat", 0, 0, 0,            NULL,
                        ret_string,         f_getcmdcomplpat},
-    {"getcmdcompltype",        0, 1, FEARG_1,      NULL,
+    {"getcmdcompltype",        0, 0, 0,            NULL,
                        ret_string,         f_getcmdcompltype},
     {"getcmdline",     0, 0, 0,            NULL,
                        ret_string,         f_getcmdline},
@@ -2280,6 +2280,8 @@ static funcentry_T global_functions[] =
                        ret_string,         f_getcmdwintype},
     {"getcompletion",  2, 3, FEARG_1,      arg3_string_string_bool,
                        ret_list_string,    f_getcompletion},
+    {"getcompletiontype", 1, 1, FEARG_1,    arg1_string,
+                       ret_string,         f_getcompletiontype},
     {"getcurpos",      0, 1, FEARG_1,      arg1_number,
                        ret_list_number,    f_getcurpos},
     {"getcursorcharpos", 0, 1, FEARG_1,            arg1_number,
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 044f3894c..f2a51ea2c 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4303,9 +4303,9 @@ get_cmdline_completion_pattern(void)
 }
 
 /*
- * Get the current command-line completion type.
+ * Get the command-line completion type.
  */
-    static char_u *
+    char_u *
 get_cmdline_completion(expand_T *xpc)
 {
     int                xp_context;
@@ -4354,40 +4354,16 @@ f_getcmdcomplpat(typval_T *argvars UNUSED, typval_T 
*rettv)
     void
 f_getcmdcompltype(typval_T *argvars UNUSED, typval_T *rettv)
 {
-    if (check_for_opt_string_arg(argvars, 0) == FAIL)
-        return;
+    cmdline_info_T *p;
 
     rettv->v_type = VAR_STRING;
+    rettv->vval.v_string = NULL;
 
-    if (argvars[0].v_type != VAR_UNKNOWN)
-    {
-        char_u         *pat;
-        expand_T       xpc;
-        int            cmdline_len;
-
-       pat = tv_get_string(&argvars[0]);
-       ExpandInit(&xpc);
-
-       cmdline_len = (int)STRLEN(pat);
-       set_cmd_context(&xpc, pat, cmdline_len, cmdline_len, FALSE);
-       xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern);
-       xpc.xp_col = cmdline_len;
-
-       rettv->v_type = VAR_STRING;
-       rettv->vval.v_string = get_cmdline_completion(&xpc);
-
-       ExpandCleanup(&xpc);
-    }
-    else
-    {
-        cmdline_info_T *p;
-
-        p = get_ccline_ptr();
-        if (cmdline_star > 0 || p == NULL || p->xpc == NULL)
-            return;
+    p = get_ccline_ptr();
+    if (cmdline_star > 0 || p == NULL || p->xpc == NULL)
+       return;
 
-        rettv->vval.v_string = get_cmdline_completion(p->xpc);
-    }
+    rettv->vval.v_string = get_cmdline_completion(p->xpc);
 }
 
 /*
diff --git a/src/proto/cmdexpand.pro b/src/proto/cmdexpand.pro
index 92e9dcb02..2b2cc23e5 100644
--- a/src/proto/cmdexpand.pro
+++ b/src/proto/cmdexpand.pro
@@ -24,5 +24,6 @@ int wildmenu_translate_key(cmdline_info_T *cclp, int key, 
expand_T *xp, int did_
 int wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp);
 void wildmenu_cleanup(cmdline_info_T *cclp);
 void f_getcompletion(typval_T *argvars, typval_T *rettv);
+void f_getcompletiontype(typval_T *argvars, typval_T *rettv);
 void f_cmdcomplete_info(typval_T *argvars UNUSED, typval_T *rettv);
 /* vim: set ft=c : */
diff --git a/src/proto/ex_getln.pro b/src/proto/ex_getln.pro
index 6c93ac755..9087c837d 100644
--- a/src/proto/ex_getln.pro
+++ b/src/proto/ex_getln.pro
@@ -30,6 +30,7 @@ char_u *vim_strsave_fnameescape(char_u *fname, int what);
 void escape_fname(char_u **pp);
 void tilde_replace(char_u *orig_pat, int num_files, char_u **files);
 cmdline_info_T *get_cmdline_info(void);
+char_u *get_cmdline_completion(expand_T *xpc);
 void f_getcmdcomplpat(typval_T *argvars, typval_T *rettv);
 void f_getcmdcompltype(typval_T *argvars, typval_T *rettv);
 void f_getcmdline(typval_T *argvars, typval_T *rettv);
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 9ebeb0f44..844f58945 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -877,6 +877,17 @@ func Test_getcompletion()
   call assert_fails('call getcompletion("abc", [])', 'E1174:')
 endfunc
 
+func Test_getcompletiontype()
+  call assert_fails('call getcompletiontype()', 'E119:')
+  call assert_fails('call getcompletiontype({})', 'E1174:')
+  call assert_equal(getcompletiontype(''), 'command')
+  call assert_equal(getcompletiontype('dummy '), '')
+  call assert_equal(getcompletiontype('cd '), 'dir_in_path')
+  call assert_equal(getcompletiontype('let v:n'), 'var')
+  call assert_equal(getcompletiontype('call tag'), 'function')
+  call assert_equal(getcompletiontype('help '), 'help')
+endfunc
+
 func Test_multibyte_expression()
   " Get a dialog in the GUI
   CheckNotGui
@@ -4589,14 +4600,4 @@ func Test_range_complete()
   set wildcharm=0
 endfunc
 
-func Test_getcmdcompltype_with_pat()
-  call assert_fails('call getcmdcompltype({})', 'E1174:')
-  call assert_equal(getcmdcompltype(''), 'command')
-  call assert_equal(getcmdcompltype('dummy '), '')
-  call assert_equal(getcmdcompltype('cd '), 'dir_in_path')
-  call assert_equal(getcmdcompltype('let v:n'), 'var')
-  call assert_equal(getcmdcompltype('call tag'), 'function')
-  call assert_equal(getcmdcompltype('help '), 'help')
-endfunc
-
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index a4545da24..3f0b6610c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1509,
 /**/
     1508,
 /**/

-- 
-- 
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/E1uY3CS-004ncs-PF%40256bit.org.

Raspunde prin e-mail lui