comparison src/os_win32.c @ 14473:2771a99db70c v8.1.0250

patch 8.1.0250: MS-Windows using VTP: windows size change incorrect commit https://github.com/vim/vim/commit/b1cf16113f7ab67f42fb6822cecdef74a54fa950 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 7 20:47:16 2018 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Tue, 07 Aug 2018 21:00:05 +0200
parents 4d3f6bf86bec
children 3375a8cbb442
comparison
equal deleted inserted replaced
14472:34f10c103329 14473:2771a99db70c
3965 } 3965 }
3966 return OK; 3966 return OK;
3967 } 3967 }
3968 3968
3969 /* 3969 /*
3970 * Resize console buffer to 'COORD'
3971 */
3972 static void
3973 ResizeConBuf(
3974 HANDLE hConsole,
3975 COORD coordScreen)
3976 {
3977 if (!SetConsoleScreenBufferSize(hConsole, coordScreen))
3978 {
3979 #ifdef MCH_WRITE_DUMP
3980 if (fdDump)
3981 {
3982 fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n",
3983 GetLastError());
3984 fflush(fdDump);
3985 }
3986 #endif
3987 }
3988 }
3989
3990 /*
3991 * Resize console window size to 'srWindowRect'
3992 */
3993 static void
3994 ResizeWindow(
3995 HANDLE hConsole,
3996 SMALL_RECT srWindowRect)
3997 {
3998 if (!SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect))
3999 {
4000 #ifdef MCH_WRITE_DUMP
4001 if (fdDump)
4002 {
4003 fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
4004 GetLastError());
4005 fflush(fdDump);
4006 }
4007 #endif
4008 }
4009 }
4010
4011 /*
3970 * Set a console window to `xSize' * `ySize' 4012 * Set a console window to `xSize' * `ySize'
3971 */ 4013 */
3972 static void 4014 static void
3973 ResizeConBufAndWindow( 4015 ResizeConBufAndWindow(
3974 HANDLE hConsole, 4016 HANDLE hConsole,
4017 coordScreen.X = sx; 4059 coordScreen.X = sx;
4018 SetConsoleScreenBufferSize(hConsole, coordScreen); 4060 SetConsoleScreenBufferSize(hConsole, coordScreen);
4019 } 4061 }
4020 } 4062 }
4021 4063
4022 if (!SetConsoleWindowInfo(g_hConOut, TRUE, &srWindowRect)) 4064 // define the new console buffer size
4023 {
4024 #ifdef MCH_WRITE_DUMP
4025 if (fdDump)
4026 {
4027 fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
4028 GetLastError());
4029 fflush(fdDump);
4030 }
4031 #endif
4032 }
4033
4034 /* define the new console buffer size */
4035 coordScreen.X = xSize; 4065 coordScreen.X = xSize;
4036 coordScreen.Y = ySize; 4066 coordScreen.Y = ySize;
4037 4067
4038 if (!SetConsoleScreenBufferSize(hConsole, coordScreen)) 4068 // In the new console call API in reverse order
4039 { 4069 if (!vtp_working)
4040 #ifdef MCH_WRITE_DUMP 4070 {
4041 if (fdDump) 4071 ResizeWindow(hConsole, srWindowRect);
4042 { 4072 ResizeConBuf(hConsole, coordScreen);
4043 fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n", 4073 }
4044 GetLastError()); 4074 else
4045 fflush(fdDump); 4075 {
4046 } 4076 ResizeConBuf(hConsole, coordScreen);
4047 #endif 4077 ResizeWindow(hConsole, srWindowRect);
4048 } 4078 }
4049 } 4079 }
4050 4080
4051 4081
4052 /* 4082 /*