From: Bram Moolenaar Date: Tue, 12 Feb 2019 22:12:37 +0000 (+0100) Subject: patch 8.1.0906: using clumsy way to get console window handle X-Git-Tag: v8.1.0906 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1ed53f3f95786c744d4b6c85bda4f476f67cc91;p=vim 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) --- diff --git a/src/os_mswin.c b/src/os_mswin.c index 8d46e53cf..8dafaa35b 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -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(); } /* diff --git a/src/version.c b/src/version.c index f28d69dc6..3a71b9392 100644 --- a/src/version.c +++ b/src/version.c @@ -783,6 +783,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 906, /**/ 905, /**/