Mercurial > vim
comparison src/GvimExt/gvimext.cpp @ 26682:64dac9ff015e v8.2.3870
patch 8.2.3870: MS-Windows: wrong dir when using right-click context menu
Commit: https://github.com/vim/vim/commit/1aeccdb464d81f0af047b399cbad160307a91f7c
Author: Nir Lichtman <nir@lichtman.org>
Date: Wed Dec 22 15:21:15 2021 +0000
patch 8.2.3870: MS-Windows: wrong dir when using right-click context menu
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 22 Dec 2021 16:30:04 +0100 |
parents | ee2808fb1be9 |
children | 32c9b7396a75 |
comparison
equal
deleted
inserted
replaced
26681:94138e1e9980 | 26682:64dac9ff015e |
---|---|
774 // and this code that determines what the user | 774 // and this code that determines what the user |
775 // selected. This should be detected and fixed during | 775 // selected. This should be detected and fixed during |
776 // development. | 776 // development. |
777 return E_FAIL; | 777 return E_FAIL; |
778 } | 778 } |
779 | |
780 LPCMINVOKECOMMANDINFOEX lpcmiex = (LPCMINVOKECOMMANDINFOEX)lpcmi; | |
781 LPCWSTR currentDirectory = lpcmi->cbSize == sizeof(CMINVOKECOMMANDINFOEX) ? lpcmiex->lpDirectoryW : NULL; | |
782 | |
779 hr = InvokeSingleGvim(lpcmi->hwnd, | 783 hr = InvokeSingleGvim(lpcmi->hwnd, |
780 lpcmi->lpDirectory, | 784 currentDirectory, |
781 lpcmi->lpVerb, | 785 lpcmi->lpVerb, |
782 lpcmi->lpParameters, | 786 lpcmi->lpParameters, |
783 lpcmi->nShow, | 787 lpcmi->nShow, |
784 gvimExtraOptions); | 788 gvimExtraOptions); |
785 } | 789 } |
882 return (char *)""; | 886 return (char *)""; |
883 } | 887 } |
884 | 888 |
885 | 889 |
886 STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent, | 890 STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent, |
887 LPCSTR /* pszWorkingDir */, | 891 LPCWSTR workingDir, |
888 LPCSTR /* pszCmd */, | 892 LPCSTR /* pszCmd */, |
889 LPCSTR /* pszParam */, | 893 LPCSTR /* pszParam */, |
890 int /* iShowCmd */, | 894 int /* iShowCmd */, |
891 int gvimExtraOptions) | 895 int gvimExtraOptions) |
892 { | 896 { |
942 NULL, // Process handle not inheritable. | 946 NULL, // Process handle not inheritable. |
943 NULL, // Thread handle not inheritable. | 947 NULL, // Thread handle not inheritable. |
944 FALSE, // Set handle inheritance to FALSE. | 948 FALSE, // Set handle inheritance to FALSE. |
945 0, // No creation flags. | 949 0, // No creation flags. |
946 NULL, // Use parent's environment block. | 950 NULL, // Use parent's environment block. |
947 NULL, // Use parent's starting directory. | 951 workingDir, // Use parent's starting directory. |
948 &si, // Pointer to STARTUPINFO structure. | 952 &si, // Pointer to STARTUPINFO structure. |
949 &pi) // Pointer to PROCESS_INFORMATION structure. | 953 &pi) // Pointer to PROCESS_INFORMATION structure. |
950 ) | 954 ) |
951 { | 955 { |
952 MessageBox( | 956 MessageBox( |