]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1509: patch 9.1.1505 was not good v9.1.1509
authorHirohito Higashi <h.east.727@gmail.com>
Sat, 5 Jul 2025 13:31:23 +0000 (15:31 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 5 Jul 2025 13:34:24 +0000 (15:34 +0200)
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.Matsu@gmail.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
runtime/doc/builtin.txt
runtime/doc/tags
runtime/doc/usr_41.txt
runtime/doc/version9.txt
runtime/syntax/vim.vim
src/cmdexpand.c
src/evalfunc.c
src/ex_getln.c
src/proto/cmdexpand.pro
src/proto/ex_getln.pro
src/testdir/test_cmdline.vim
src/version.c

index 8f9c7baa21076e9a8c5618c7c6da33788e85ae5b..f38948c75a7b1e4ee5fb79ec935f0cf117f7a3f5 100644 (file)
@@ -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
index 6b363dbaa9d38a72338b272152522c8e59378f24..3f83210b490be58d1f7b33ded5d7267709021467 100644 (file)
@@ -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()*
index 9b8cdc2beaa29f2b81310dbe83ef178cc098e0ab..02d58f0d8e7467b27484d41137bb21ec3fadf318 100644 (file)
@@ -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
 
index 75d14011ab19261ea5604aa00d1b397de89c5d0b..f53399587840a0b9b55ff46c3e1d77f8f4ad89cf 100644 (file)
@@ -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
index 528706fdba2b4517928d416c2e153921343d8d0c..e04429eb035b46471d0da71c29269a10887a10e3 100644 (file)
@@ -2,7 +2,7 @@
 " Language:       Vim script
 " Maintainer:     Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "         Doug Kearns <dougkearns@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
index f7a5f5cc639d445f023313b9994f91e1d54da135..b1c9ed67ab7f3c9fb99d1f74411df82d051481ed 100644 (file)
@@ -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
  */
index 6ba698d56613c6460790c2037c3881f0ca26ca3c..ec21087e252c79f3ac673148ff97427a4a1d8c84 100644 (file)
@@ -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,
index 044f3894c9b615cdde0b5794eb1a8a835b25a944..f2a51ea2c86af0702bde7b34fb93924d43cadc17 100644 (file)
@@ -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);
 }
 
 /*
index 92e9dcb02493098d3cd7f349a003b31ad950669b..2b2cc23e5afda88777d2c11ef73c6ead206bf594 100644 (file)
@@ -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 : */
index 6c93ac755a24ca017f1cc6963710b07182f13d45..9087c837dfa6915e9b1b4d0fa25b79654f3a6f71 100644 (file)
@@ -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);
index 9ebeb0f44aefb6eb88bd9fd661c0fc66876815ae..844f58945c8da0ad749604f14ab5313253bfe959 100644 (file)
@@ -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
index a4545da242457e47d0caf8c32de1080e2ee16008..3f0b6610ce2f2a5982111599a85d668f7d3858b7 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1509,
 /**/
     1508,
 /**/