mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.1.0906: using clumsy way to get console window handle
Problem: Using clumsy way to get console window handle. Solution: Use GetConsoleWindow(). (Ken Takata, closes #3940)
This commit is contained in:
@@ -1043,11 +1043,6 @@ extern HWND g_hWnd; /* This is in os_win32.c. */
|
|||||||
static void
|
static void
|
||||||
GetConsoleHwnd(void)
|
GetConsoleHwnd(void)
|
||||||
{
|
{
|
||||||
# define MY_BUFSIZE 1024 // Buffer size for console window titles.
|
|
||||||
|
|
||||||
char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated WindowTitle.
|
|
||||||
char pszOldWindowTitle[MY_BUFSIZE]; // Contains original WindowTitle.
|
|
||||||
|
|
||||||
/* Skip if it's already set. */
|
/* Skip if it's already set. */
|
||||||
if (s_hwnd != 0)
|
if (s_hwnd != 0)
|
||||||
return;
|
return;
|
||||||
@@ -1061,17 +1056,7 @@ GetConsoleHwnd(void)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
|
s_hwnd = GetConsoleWindow();
|
||||||
|
|
||||||
wsprintf(pszNewWindowTitle, "%s/%d/%d",
|
|
||||||
pszOldWindowTitle,
|
|
||||||
GetTickCount(),
|
|
||||||
GetCurrentProcessId());
|
|
||||||
SetConsoleTitle(pszNewWindowTitle);
|
|
||||||
Sleep(40);
|
|
||||||
s_hwnd = FindWindow(NULL, pszNewWindowTitle);
|
|
||||||
|
|
||||||
SetConsoleTitle(pszOldWindowTitle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -783,6 +783,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
906,
|
||||||
/**/
|
/**/
|
||||||
905,
|
905,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user