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
|
||||
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. */
|
||||
if (s_hwnd != 0)
|
||||
return;
|
||||
@@ -1061,17 +1056,7 @@ GetConsoleHwnd(void)
|
||||
}
|
||||
# endif
|
||||
|
||||
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
|
||||
|
||||
wsprintf(pszNewWindowTitle, "%s/%d/%d",
|
||||
pszOldWindowTitle,
|
||||
GetTickCount(),
|
||||
GetCurrentProcessId());
|
||||
SetConsoleTitle(pszNewWindowTitle);
|
||||
Sleep(40);
|
||||
s_hwnd = FindWindow(NULL, pszNewWindowTitle);
|
||||
|
||||
SetConsoleTitle(pszOldWindowTitle);
|
||||
s_hwnd = GetConsoleWindow();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -783,6 +783,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
906,
|
||||
/**/
|
||||
905,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user