0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3623: "$*" is expanded to "nonomatch"

Problem:    "$*" is expanded to "nonomatch".
Solution:   Only add "set nonomatch" when using a csh-like shell. (Christian
            Brabandt, closes #9159, closes #9153)
This commit is contained in:
Christian Brabandt
2021-11-19 12:37:36 +00:00
committed by Bram Moolenaar
parent 64be6aa3a5
commit 8b8d829faf
4 changed files with 19 additions and 7 deletions

View File

@@ -1009,9 +1009,6 @@ or `unnamedplus`.
The `mode()` function will return the state as it will be after applying the The `mode()` function will return the state as it will be after applying the
operator. operator.
The `mode()` function will return the state as it will be after applying the
operator.
Here is an example for using a lambda function to create a normal-mode Here is an example for using a lambda function to create a normal-mode
operator to add quotes around text in the current line: > operator to add quotes around text in the current line: >

View File

@@ -6691,10 +6691,17 @@ mch_expand_wildcards(
} }
else else
{ {
STRCPY(command, "");
if (shell_style == STYLE_GLOB)
{
// Assume the nonomatch option is valid only for csh like shells,
// otherwise, this may set the positional parameters for the shell,
// e.g. "$*".
if (flags & EW_NOTFOUND) if (flags & EW_NOTFOUND)
STRCPY(command, "set nonomatch; "); STRCAT(command, "set nonomatch; ");
else else
STRCPY(command, "unset nonomatch; "); STRCAT(command, "unset nonomatch; ");
}
if (shell_style == STYLE_GLOB) if (shell_style == STYLE_GLOB)
STRCAT(command, "glob >"); STRCAT(command, "glob >");
else if (shell_style == STYLE_PRINT) else if (shell_style == STYLE_PRINT)

View File

@@ -1,6 +1,7 @@
" Test for expanding file names " Test for expanding file names
source shared.vim source shared.vim
source check.vim
func Test_with_directories() func Test_with_directories()
call mkdir('Xdir1') call mkdir('Xdir1')
@@ -135,4 +136,9 @@ func Test_expand_filename_multicmd()
%bwipe! %bwipe!
endfunc endfunc
func Test_expandcmd_shell_nonomatch()
CheckNotMSWindows
call assert_equal('$*', expandcmd('$*'))
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3623,
/**/ /**/
3622, 3622,
/**/ /**/