mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
Support wide file names in gvimext. (Szabolcs Horvat)
This commit is contained in:
@@ -1089,11 +1089,10 @@ Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler,
|
|||||||
|
|
||||||
|
|
||||||
Vim 7.3:
|
Vim 7.3:
|
||||||
- in August remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV.
|
- soon: remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV.
|
||||||
- Conceal feature: no update when moving to another window. (Dominique Pelle,
|
- Conceal feature: no update when moving to another window. (Dominique Pelle,
|
||||||
2010 Jul 5) Vince will look into it.
|
2010 Jul 5) Vince will look into it.
|
||||||
Patches to include:
|
Patches to include:
|
||||||
- Patch for Lisp support with ECL (Mikael Jansson, 2008 Oct 25)
|
|
||||||
- Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10)
|
- Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10)
|
||||||
- Patch to support netbeans for Mac. (Kazuki Sakamoto, 2009 Jun 25)
|
- Patch to support netbeans for Mac. (Kazuki Sakamoto, 2009 Jun 25)
|
||||||
- Patch to support clipboard for Mac terminal. (Jjgod Jiang, 2009 Aug 1)
|
- Patch to support clipboard for Mac terminal. (Jjgod Jiang, 2009 Aug 1)
|
||||||
|
@@ -85,6 +85,17 @@ getGvimName(char *name, int runtime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
getGvimNameW(wchar_t *nameW)
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
name = (char *)malloc(BUFSIZE);
|
||||||
|
getGvimName(name, 0);
|
||||||
|
mbstowcs(nameW, name, BUFSIZE);
|
||||||
|
free(name);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Vim runtime directory into buf[BUFSIZE].
|
// Get the Vim runtime directory into buf[BUFSIZE].
|
||||||
// The result is empty when it failed.
|
// The result is empty when it failed.
|
||||||
@@ -848,34 +859,34 @@ STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,
|
|||||||
LPCSTR /* pszParam */,
|
LPCSTR /* pszParam */,
|
||||||
int /* iShowCmd */)
|
int /* iShowCmd */)
|
||||||
{
|
{
|
||||||
char m_szFileUserClickedOn[BUFSIZE];
|
wchar_t m_szFileUserClickedOn[BUFSIZE];
|
||||||
char cmdStr[BUFSIZE];
|
wchar_t cmdStrW[BUFSIZE];
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i = 0; i < cbFiles; i++)
|
for (i = 0; i < cbFiles; i++)
|
||||||
{
|
{
|
||||||
DragQueryFile((HDROP)medium.hGlobal,
|
DragQueryFileW((HDROP)medium.hGlobal,
|
||||||
i,
|
i,
|
||||||
m_szFileUserClickedOn,
|
m_szFileUserClickedOn,
|
||||||
sizeof(m_szFileUserClickedOn));
|
sizeof(m_szFileUserClickedOn));
|
||||||
|
|
||||||
getGvimName(cmdStr, 0);
|
getGvimNameW(cmdStrW);
|
||||||
strcat(cmdStr, " \"");
|
wcscat(cmdStrW, L" \"");
|
||||||
|
|
||||||
if ((strlen(cmdStr) + strlen(m_szFileUserClickedOn) + 2) < BUFSIZE)
|
if ((wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 2) < BUFSIZE)
|
||||||
{
|
{
|
||||||
strcat(cmdStr, m_szFileUserClickedOn);
|
wcscat(cmdStrW, m_szFileUserClickedOn);
|
||||||
strcat(cmdStr, "\"");
|
wcscat(cmdStrW, L"\"");
|
||||||
|
|
||||||
STARTUPINFO si;
|
STARTUPINFOW si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
ZeroMemory(&si, sizeof(si));
|
ZeroMemory(&si, sizeof(si));
|
||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
|
|
||||||
// Start the child process.
|
// Start the child process.
|
||||||
if (!CreateProcess(NULL, // No module name (use command line).
|
if (!CreateProcessW(NULL, // No module name (use command line).
|
||||||
cmdStr, // Command line.
|
cmdStrW, // Command line.
|
||||||
NULL, // Process handle not inheritable.
|
NULL, // Process handle not inheritable.
|
||||||
NULL, // Thread handle not inheritable.
|
NULL, // Thread handle not inheritable.
|
||||||
FALSE, // Set handle inheritance to FALSE.
|
FALSE, // Set handle inheritance to FALSE.
|
||||||
@@ -919,44 +930,45 @@ STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
|
|||||||
int /* iShowCmd */,
|
int /* iShowCmd */,
|
||||||
int useDiff)
|
int useDiff)
|
||||||
{
|
{
|
||||||
char m_szFileUserClickedOn[BUFSIZE];
|
wchar_t m_szFileUserClickedOn[BUFSIZE];
|
||||||
char *cmdStr;
|
wchar_t *cmdStrW;
|
||||||
size_t cmdlen;
|
size_t cmdlen;
|
||||||
size_t len;
|
size_t len;
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
cmdlen = BUFSIZE;
|
cmdlen = BUFSIZE;
|
||||||
cmdStr = (char *)malloc(cmdlen);
|
cmdStrW = (wchar_t *) malloc(cmdlen * sizeof(wchar_t));
|
||||||
getGvimName(cmdStr, 0);
|
getGvimNameW(cmdStrW);
|
||||||
|
|
||||||
if (useDiff)
|
if (useDiff)
|
||||||
strcat(cmdStr, " -d");
|
wcscat(cmdStrW, L" -d");
|
||||||
for (i = 0; i < cbFiles; i++)
|
for (i = 0; i < cbFiles; i++)
|
||||||
{
|
{
|
||||||
DragQueryFile((HDROP)medium.hGlobal,
|
DragQueryFileW((HDROP)medium.hGlobal,
|
||||||
i,
|
i,
|
||||||
m_szFileUserClickedOn,
|
m_szFileUserClickedOn,
|
||||||
sizeof(m_szFileUserClickedOn));
|
sizeof(m_szFileUserClickedOn));
|
||||||
|
|
||||||
len = strlen(cmdStr) + strlen(m_szFileUserClickedOn) + 4;
|
len = wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 4;
|
||||||
if (len > cmdlen)
|
if (len > cmdlen)
|
||||||
{
|
{
|
||||||
cmdlen = len + BUFSIZE;
|
cmdlen = len + BUFSIZE;
|
||||||
cmdStr = (char *)realloc(cmdStr, cmdlen);
|
cmdStrW = (wchar_t *)realloc(cmdStrW, cmdlen * sizeof(wchar_t));
|
||||||
}
|
}
|
||||||
strcat(cmdStr, " \"");
|
wcscat(cmdStrW, L" \"");
|
||||||
strcat(cmdStr, m_szFileUserClickedOn);
|
wcscat(cmdStrW, m_szFileUserClickedOn);
|
||||||
strcat(cmdStr, "\"");
|
wcscat(cmdStrW, L"\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
STARTUPINFO si;
|
STARTUPINFOW si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
|
|
||||||
ZeroMemory(&si, sizeof(si));
|
ZeroMemory(&si, sizeof(si));
|
||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
|
|
||||||
// Start the child process.
|
// Start the child process.
|
||||||
if (!CreateProcess(NULL, // No module name (use command line).
|
if (!CreateProcessW(NULL, // No module name (use command line).
|
||||||
cmdStr, // Command line.
|
cmdStrW, // Command line.
|
||||||
NULL, // Process handle not inheritable.
|
NULL, // Process handle not inheritable.
|
||||||
NULL, // Thread handle not inheritable.
|
NULL, // Thread handle not inheritable.
|
||||||
FALSE, // Set handle inheritance to FALSE.
|
FALSE, // Set handle inheritance to FALSE.
|
||||||
@@ -979,7 +991,7 @@ STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
|
|||||||
CloseHandle(pi.hThread);
|
CloseHandle(pi.hThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cmdStr);
|
free(cmdStrW);
|
||||||
|
|
||||||
return NOERROR;
|
return NOERROR;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user