0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.0250: MS-Windows using VTP: windows size change incorrect

Problem:    MS-Windows using VTP: windows size change incorrect.
Solution:   Call SetConsoleScreenBufferSize() first. (Nobuhiro Takasaki,
            closes #3164)
This commit is contained in:
Bram Moolenaar
2018-08-07 20:47:16 +02:00
parent 7ebf4e1c34
commit b1cf16113f
2 changed files with 54 additions and 22 deletions

View File

@@ -3966,6 +3966,48 @@ mch_get_shellsize(void)
return OK; return OK;
} }
/*
* Resize console buffer to 'COORD'
*/
static void
ResizeConBuf(
HANDLE hConsole,
COORD coordScreen)
{
if (!SetConsoleScreenBufferSize(hConsole, coordScreen))
{
#ifdef MCH_WRITE_DUMP
if (fdDump)
{
fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n",
GetLastError());
fflush(fdDump);
}
#endif
}
}
/*
* Resize console window size to 'srWindowRect'
*/
static void
ResizeWindow(
HANDLE hConsole,
SMALL_RECT srWindowRect)
{
if (!SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect))
{
#ifdef MCH_WRITE_DUMP
if (fdDump)
{
fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
GetLastError());
fflush(fdDump);
}
#endif
}
}
/* /*
* Set a console window to `xSize' * `ySize' * Set a console window to `xSize' * `ySize'
*/ */
@@ -4019,32 +4061,20 @@ ResizeConBufAndWindow(
} }
} }
if (!SetConsoleWindowInfo(g_hConOut, TRUE, &srWindowRect)) // define the new console buffer size
{
#ifdef MCH_WRITE_DUMP
if (fdDump)
{
fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
GetLastError());
fflush(fdDump);
}
#endif
}
/* define the new console buffer size */
coordScreen.X = xSize; coordScreen.X = xSize;
coordScreen.Y = ySize; coordScreen.Y = ySize;
if (!SetConsoleScreenBufferSize(hConsole, coordScreen)) // In the new console call API in reverse order
if (!vtp_working)
{ {
#ifdef MCH_WRITE_DUMP ResizeWindow(hConsole, srWindowRect);
if (fdDump) ResizeConBuf(hConsole, coordScreen);
{ }
fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n", else
GetLastError()); {
fflush(fdDump); ResizeConBuf(hConsole, coordScreen);
} ResizeWindow(hConsole, srWindowRect);
#endif
} }
} }

View File

@@ -794,6 +794,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 */
/**/
250,
/**/ /**/
249, 249,
/**/ /**/