]> granicus.if.org Git - vim/commitdiff
patch 8.2.3623: "$*" is expanded to "nonomatch" v8.2.3623
authorChristian Brabandt <cb@256bit.org>
Fri, 19 Nov 2021 12:37:36 +0000 (12:37 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 19 Nov 2021 12:37:36 +0000 (12:37 +0000)
Problem:    "$*" is expanded to "nonomatch".
Solution:   Only add "set nonomatch" when using a csh-like shell. (Christian
            Brabandt, closes #9159, closes #9153)

runtime/doc/map.txt
src/os_unix.c
src/testdir/test_expand.vim
src/version.c

index 4d23f4a5dc1dc34238cf8a3d3044f0665ac17177..b700c822ece12ef9bc06e1f524093809ae612656 100644 (file)
@@ -1009,9 +1009,6 @@ or `unnamedplus`.
 The `mode()` function will return the state as it will be after applying the
 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
 operator to add quotes around text in the current line: >
 
index 0b2b5725eb78268d3787f33be1eab2cb2592da42..fa9c5f3929830fc2e678babcfc3a6b15492313bf 100644 (file)
@@ -6691,10 +6691,17 @@ mch_expand_wildcards(
     }
     else
     {
-       if (flags & EW_NOTFOUND)
-           STRCPY(command, "set nonomatch; ");
-       else
-           STRCPY(command, "unset nonomatch; ");
+       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)
+               STRCAT(command, "set nonomatch; ");
+           else
+               STRCAT(command, "unset nonomatch; ");
+       }
        if (shell_style == STYLE_GLOB)
            STRCAT(command, "glob >");
        else if (shell_style == STYLE_PRINT)
index 86062234d50dae1f8b1070814842345258bcd6cd..e68d55e1050006579e0de4b2577b29000504c62b 100644 (file)
@@ -1,6 +1,7 @@
 " Test for expanding file names
 
 source shared.vim
+source check.vim
 
 func Test_with_directories()
   call mkdir('Xdir1')
@@ -135,4 +136,9 @@ func Test_expand_filename_multicmd()
   %bwipe!
 endfunc
 
+func Test_expandcmd_shell_nonomatch()
+  CheckNotMSWindows
+  call assert_equal('$*', expandcmd('$*'))
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 94238de7618aed578497c24b9e3e486bc11334a5..919a802d3cfa897b17a54032f3e6bf8ba7474a83 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3623,
 /**/
     3622,
 /**/