]> granicus.if.org Git - vim/commitdiff
patch 9.0.1242: code for :runtime completion is not consistent v9.0.1242
authorzeertzjq <zeertzjq@outlook.com>
Wed, 25 Jan 2023 15:04:22 +0000 (15:04 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 25 Jan 2023 15:04:22 +0000 (15:04 +0000)
Problem:    Code for :runtime completion is not consistent.
Solution:   Make code for cmdline expansion more consistent. (closes #11875)

src/cmdexpand.c
src/option.c
src/proto/option.pro
src/testdir/test_packadd.vim
src/version.c

index 8ca5ecddc399b1f727b7d979718024868833dff8..23661578037d99e27d630270ab57bded831c6aec 100644 (file)
@@ -1363,11 +1363,11 @@ addstar(
        // For a tag pattern starting with "/" no translation is needed.
        if (context == EXPAND_HELP
                || context == EXPAND_COLORS
-               || context == EXPAND_RUNTIME
                || context == EXPAND_COMPILER
                || context == EXPAND_OWNSYNTAX
                || context == EXPAND_FILETYPE
                || context == EXPAND_PACKADD
+               || context == EXPAND_RUNTIME
                || ((context == EXPAND_TAGS_LISTFILES
                        || context == EXPAND_TAGS)
                    && fname[0] == '/'))
@@ -2314,10 +2314,6 @@ set_context_by_cmdname(
            xp->xp_pattern = arg;
            break;
 
-       case CMD_runtime:
-           set_context_in_runtime_cmd(xp, arg);
-           break;
-
        case CMD_compiler:
            xp->xp_context = EXPAND_COMPILER;
            xp->xp_pattern = arg;
@@ -2338,6 +2334,10 @@ set_context_by_cmdname(
            xp->xp_pattern = arg;
            break;
 
+       case CMD_runtime:
+           set_context_in_runtime_cmd(xp, arg);
+           break;
+
 #if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
        case CMD_language:
            return set_context_in_lang_cmd(xp, arg);
index 386cf4d3c3a5156d04608d2a489bf5215a81a98e..528be65aaca1fdad714e98ef1c35dd60c0f56ef8 100644 (file)
@@ -6713,14 +6713,14 @@ ExpandSettings(
 }
 
     int
-ExpandOldSetting(int *num_file, char_u ***file)
+ExpandOldSetting(int *numMatches, char_u ***matches)
 {
     char_u  *var = NULL;       // init for GCC
     char_u  *buf;
 
-    *num_file = 0;
-    *file = ALLOC_ONE(char_u *);
-    if (*file == NULL)
+    *numMatches = 0;
+    *matches = ALLOC_ONE(char_u *);
+    if (*matches == NULL)
        return FAIL;
 
     /*
@@ -6748,7 +6748,7 @@ ExpandOldSetting(int *num_file, char_u ***file)
 
     if (buf == NULL)
     {
-       VIM_CLEAR(*file);
+       VIM_CLEAR(*matches);
        return FAIL;
     }
 
@@ -6764,8 +6764,8 @@ ExpandOldSetting(int *num_file, char_u ***file)
            STRMOVE(var, var + 1);
 #endif
 
-    *file[0] = buf;
-    *num_file = 1;
+    *matches[0] = buf;
+    *numMatches = 1;
     return OK;
 }
 
index ca150b6bb573d79396c199b546d702eda4b0ecc1..b32b95ed341b0dcc4572805882f3a7ee172d9c4e 100644 (file)
@@ -66,7 +66,7 @@ void set_iminsert_global(void);
 void set_imsearch_global(void);
 void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags);
 int ExpandSettings(expand_T *xp, regmatch_T *regmatch, char_u *fuzzystr, int *numMatches, char_u ***matches, int can_fuzzy);
-int ExpandOldSetting(int *num_file, char_u ***file);
+int ExpandOldSetting(int *numMatches, char_u ***matches);
 int shortmess(int x);
 void vimrc_found(char_u *fname, char_u *envname);
 void change_compatible(int on);
index 332f0094c3477fdefbb7ca487f0815c74c34596b..89b7817682951e133c0f980df4774c5d2abf27c2 100644 (file)
@@ -27,7 +27,7 @@ func Test_packadd()
 
   let rtp_entries = split(rtp, ',')
   for entry in rtp_entries
-    if entry =~? '\<after\>' 
+    if entry =~? '\<after\>'
       let first_after_entry = entry
       break
     endif
@@ -183,7 +183,7 @@ func Test_packadd_symlink_dir2()
   exec "silent !rmdir" top2_dir
 endfunc
 
-" Check command-line completion for 'packadd'
+" Check command-line completion for :packadd
 func Test_packadd_completion()
   let optdir1 = &packpath . '/pack/mine/opt'
   let optdir2 = &packpath . '/pack/candidate/opt'
@@ -271,9 +271,9 @@ func Test_helptags()
 
   helptags ALL
 
-  let tags1 = readfile(docdir1 . '/tags') 
+  let tags1 = readfile(docdir1 . '/tags')
   call assert_match('look-here', tags1[0])
-  let tags2 = readfile(docdir2 . '/tags') 
+  let tags2 = readfile(docdir2 . '/tags')
   call assert_match('look-away', tags2[0])
 
   call assert_fails('helptags abcxyz', 'E150:')
index cfe6e6a651f663465620a5e58041456db741a542..5c594446490dd3bda6d6a8fd01ba63b2f57d89b6 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1242,
 /**/
     1241,
 /**/