]> granicus.if.org Git - vim/commitdiff
patch 8.2.3870: MS-Windows: wrong dir when using right-click context menu v8.2.3870
authorNir Lichtman <nir@lichtman.org>
Wed, 22 Dec 2021 15:21:15 +0000 (15:21 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 22 Dec 2021 15:21:15 +0000 (15:21 +0000)
Problem:    MS-Windows: wrong working directory when opening two files with
            right-click context menu. (Gabriel Dupras)
Solution:   Use the working directory and pass it on to the process creation.
            (Nir Lichtman, closes #9382, closes #8874)

src/GvimExt/gvimext.cpp
src/GvimExt/gvimext.h
src/version.c

index e56379caef54b97f4992ac3d9ad797f4f488cfba..dd26eb1b694b3b248a125ae4939420c0343d95fb 100644 (file)
@@ -776,8 +776,12 @@ STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
                    // development.
                    return E_FAIL;
            }
+
+            LPCMINVOKECOMMANDINFOEX lpcmiex = (LPCMINVOKECOMMANDINFOEX)lpcmi;
+            LPCWSTR currentDirectory = lpcmi->cbSize == sizeof(CMINVOKECOMMANDINFOEX) ? lpcmiex->lpDirectoryW : NULL;
+
            hr = InvokeSingleGvim(lpcmi->hwnd,
-                   lpcmi->lpDirectory,
+                   currentDirectory,
                    lpcmi->lpVerb,
                    lpcmi->lpParameters,
                    lpcmi->nShow,
@@ -884,7 +888,7 @@ searchpath(char *name)
 
 
 STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
-                                  LPCSTR  /* pszWorkingDir */,
+                                  LPCWSTR  workingDir,
                                   LPCSTR  /* pszCmd */,
                                   LPCSTR  /* pszParam */,
                                   int  /* iShowCmd */,
@@ -944,7 +948,7 @@ STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
                FALSE,          // Set handle inheritance to FALSE.
                0,              // No creation flags.
                NULL,           // Use parent's environment block.
-               NULL,           // Use parent's starting directory.
+               workingDir,  // Use parent's starting directory.
                &si,            // Pointer to STARTUPINFO structure.
                &pi)            // Pointer to PROCESS_INFORMATION structure.
        )
index 3ad797e76b926edd513c51db202d05f1cc688cff..b6be3a7975b718c507c83cace079753c45ecdb8d 100644 (file)
@@ -130,7 +130,7 @@ protected:
            int idHWnd);
 
     STDMETHODIMP InvokeSingleGvim(HWND hParent,
-           LPCSTR pszWorkingDir,
+           LPCWSTR workingDir,
            LPCSTR pszCmd,
            LPCSTR pszParam,
            int iShowCmd,
index c5877df998baff3a998c500cfeaf0d335c1b8586..50902d622247dc135efaea8c75e7caf6c041f939 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3870,
 /**/
     3869,
 /**/