Patch 9.0.1242

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 25, 2023, 10:04:58 AM1/25/23
to vim...@googlegroups.com

Patch 9.0.1242
Problem: Code for :runtime completion is not consistent.
Solution: Make code for cmdline expansion more consistent. (closes #11875)
Files: src/cmdexpand.c, src/option.c, src/proto/option.pro,
src/testdir/test_packadd.vim


*** ../vim-9.0.1241/src/cmdexpand.c 2023-01-24 12:33:58.946777427 +0000
--- src/cmdexpand.c 2023-01-25 14:40:50.099935861 +0000
***************
*** 1363,1373 ****
// 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_TAGS_LISTFILES
|| context == EXPAND_TAGS)
&& fname[0] == '/'))
--- 1363,1373 ----
// For a tag pattern starting with "/" no translation is needed.
if (context == EXPAND_HELP
|| context == EXPAND_COLORS
|| 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,2323 ****
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;
--- 2314,2319 ----
***************
*** 2338,2343 ****
--- 2334,2343 ----
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);
*** ../vim-9.0.1241/src/option.c 2023-01-17 21:38:22.138223711 +0000
--- src/option.c 2023-01-25 14:40:50.103935861 +0000
***************
*** 6713,6726 ****
}

int
! ExpandOldSetting(int *num_file, char_u ***file)
{
char_u *var = NULL; // init for GCC
char_u *buf;

! *num_file = 0;
! *file = ALLOC_ONE(char_u *);
! if (*file == NULL)
return FAIL;

/*
--- 6713,6726 ----
}

int
! ExpandOldSetting(int *numMatches, char_u ***matches)
{
char_u *var = NULL; // init for GCC
char_u *buf;

! *numMatches = 0;
! *matches = ALLOC_ONE(char_u *);
! if (*matches == NULL)
return FAIL;

/*
***************
*** 6748,6754 ****

if (buf == NULL)
{
! VIM_CLEAR(*file);
return FAIL;
}

--- 6748,6754 ----

if (buf == NULL)
{
! VIM_CLEAR(*matches);
return FAIL;
}

***************
*** 6764,6771 ****
STRMOVE(var, var + 1);
#endif

! *file[0] = buf;
! *num_file = 1;
return OK;
}

--- 6764,6771 ----
STRMOVE(var, var + 1);
#endif

! *matches[0] = buf;
! *numMatches = 1;
return OK;
}

*** ../vim-9.0.1241/src/proto/option.pro 2022-07-27 12:30:08.405165929 +0100
--- src/proto/option.pro 2023-01-25 14:40:50.103935861 +0000
***************
*** 66,72 ****
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 shortmess(int x);
void vimrc_found(char_u *fname, char_u *envname);
void change_compatible(int on);
--- 66,72 ----
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 *numMatches, char_u ***matches);
int shortmess(int x);
void vimrc_found(char_u *fname, char_u *envname);
void change_compatible(int on);
*** ../vim-9.0.1241/src/testdir/test_packadd.vim 2023-01-24 12:33:58.950777425 +0000
--- src/testdir/test_packadd.vim 2023-01-25 14:40:50.103935861 +0000
***************
*** 27,33 ****

let rtp_entries = split(rtp, ',')
for entry in rtp_entries
! if entry =~? '\<after\>'
let first_after_entry = entry
break
endif
--- 27,33 ----

let rtp_entries = split(rtp, ',')
for entry in rtp_entries
! if entry =~? '\<after\>'
let first_after_entry = entry
break
endif
***************
*** 183,189 ****
exec "silent !rmdir" top2_dir
endfunc

! " Check command-line completion for 'packadd'
func Test_packadd_completion()
let optdir1 = &packpath . '/pack/mine/opt'
let optdir2 = &packpath . '/pack/candidate/opt'
--- 183,189 ----
exec "silent !rmdir" top2_dir
endfunc

! " Check command-line completion for :packadd
func Test_packadd_completion()
let optdir1 = &packpath . '/pack/mine/opt'
let optdir2 = &packpath . '/pack/candidate/opt'
***************
*** 271,279 ****

helptags ALL

! let tags1 = readfile(docdir1 . '/tags')
call assert_match('look-here', tags1[0])
! let tags2 = readfile(docdir2 . '/tags')
call assert_match('look-away', tags2[0])

call assert_fails('helptags abcxyz', 'E150:')
--- 271,279 ----

helptags ALL

! let tags1 = readfile(docdir1 . '/tags')
call assert_match('look-here', tags1[0])
! let tags2 = readfile(docdir2 . '/tags')
call assert_match('look-away', tags2[0])

call assert_fails('helptags abcxyz', 'E150:')
*** ../vim-9.0.1241/src/version.c 2023-01-25 12:27:09.454493126 +0000
--- src/version.c 2023-01-25 14:42:29.271930838 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1242,
/**/

--
hundred-and-one symptoms of being an internet addict:
42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages