]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1379: MS-Windows: error when running evim when space in path v9.1.1379
authorGuyBrush <miguel.barro@live.com>
Sat, 10 May 2025 18:44:33 +0000 (20:44 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 10 May 2025 18:44:33 +0000 (20:44 +0200)
Problem:  MS-Windows: error when running evim when space in path of Vim
Solution: properly parse quoted strings (Miguel Barro)

When vim is installed in a path with whitespaces (like
`C:\Program Files (x86)\Vim\vim91\vim.exe`). Launching `evim` or
`vim -d` will try to open the file ` (x86)\Vim\vim91\vim.exe`.

Modern versions of vim simplify shell operation by parsing its own
command line. For example on Linux all vim flavours like `evim`, `rvim`,
etc are symlinks to vim. Then vim uses the `parse_command_name()`
function to identify which version of vim it should launch.
For `evim` if a GUI is available `gvim` is launched for better user
experience. In order to launch `gvim` the original command line is
parsed to be passed *verbatim* to the new instance.
This parsing did not properly handle quoted command lines with
whitespaces such as
```
"C:\Program Files (x86)\Vim\vim91\vim.exe" -y myfile.txt
```

closes: #17295

Signed-off-by: Miguel Barro <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/gui_w32.c
src/version.c

index 400169a59ca8d5ddbd09a3da3b790a66a5b66797..a29fa91b0a2a1585d0e1496dbb411678021ce490 100644 (file)
@@ -5384,13 +5384,11 @@ gui_mch_do_spawn(char_u *arg)
        {
            if (*p == L'"')
            {
-               while (*p && *p != L'"')
-                   ++p;
-               if (*p)
-                   ++p;
+               // Skip quoted strings
+               while (*++p && *p != L'"');
            }
-           else
-               ++p;
+
+           ++p;
        }
        cmd = p;
     }
index c84709e5007ab05db4ec3997640bde42ea43c030..b0dc438870bbf74913423b01135d17fcc8e63b8b 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1379,
 /**/
     1378,
 /**/