diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-25 15:04:22 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-25 15:04:22 +0000 |
commit | b0d45ec67f4976318f199a7929ad3bcf93686fd0 (patch) | |
tree | f3e8c92e790367c6f4886da4cc48e94bff4fe2f8 | |
parent | b58201035060d223d4d795ef9c3bc6b171eee9af (diff) | |
download | vim-git-b0d45ec67f4976318f199a7929ad3bcf93686fd0.tar.gz |
patch 9.0.1242: code for :runtime completion is not consistentv9.0.1242
Problem: Code for :runtime completion is not consistent.
Solution: Make code for cmdline expansion more consistent. (closes #11875)
-rw-r--r-- | src/cmdexpand.c | 10 | ||||
-rw-r--r-- | src/option.c | 14 | ||||
-rw-r--r-- | src/proto/option.pro | 2 | ||||
-rw-r--r-- | src/testdir/test_packadd.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
5 files changed, 19 insertions, 17 deletions
diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 8ca5ecddc..236615780 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -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); diff --git a/src/option.c b/src/option.c index 386cf4d3c..528be65aa 100644 --- a/src/option.c +++ b/src/option.c @@ -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; } diff --git a/src/proto/option.pro b/src/proto/option.pro index ca150b6bb..b32b95ed3 100644 --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -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); diff --git a/src/testdir/test_packadd.vim b/src/testdir/test_packadd.vim index 332f0094c..89b781768 100644 --- a/src/testdir/test_packadd.vim +++ b/src/testdir/test_packadd.vim @@ -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:') diff --git a/src/version.c b/src/version.c index cfe6e6a65..5c5944464 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1242, +/**/ 1241, /**/ 1240, |