]> granicus.if.org Git - vim/commitdiff
patch 8.1.0250: MS-Windows using VTP: windows size change incorrect v8.1.0250
authorBram Moolenaar <Bram@vim.org>
Tue, 7 Aug 2018 18:47:16 +0000 (20:47 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 7 Aug 2018 18:47:16 +0000 (20:47 +0200)
Problem:    MS-Windows using VTP: windows size change incorrect.
Solution:   Call SetConsoleScreenBufferSize() first. (Nobuhiro Takasaki,
            closes #3164)

src/os_win32.c
src/version.c

index f8884e401164b337d0256830ecdc3ea5837fce38..63572350b2877e65a822737433787bb819e582cb 100644 (file)
@@ -3966,6 +3966,48 @@ mch_get_shellsize(void)
     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'
  */
@@ -4019,32 +4061,20 @@ ResizeConBufAndWindow(
        }
     }
 
-    if (!SetConsoleWindowInfo(g_hConOut, TRUE, &srWindowRect))
-    {
-#ifdef MCH_WRITE_DUMP
-       if (fdDump)
-       {
-           fprintf(fdDump, "SetConsoleWindowInfo failed: %lx\n",
-                   GetLastError());
-           fflush(fdDump);
-       }
-#endif
-    }
-
-    /* define the new console buffer size */
+    // define the new console buffer size
     coordScreen.X = xSize;
     coordScreen.Y = ySize;
 
-    if (!SetConsoleScreenBufferSize(hConsole, coordScreen))
+    // In the new console call API in reverse order
+    if (!vtp_working)
     {
-#ifdef MCH_WRITE_DUMP
-       if (fdDump)
-       {
-           fprintf(fdDump, "SetConsoleScreenBufferSize failed: %lx\n",
-                   GetLastError());
-           fflush(fdDump);
-       }
-#endif
+       ResizeWindow(hConsole, srWindowRect);
+       ResizeConBuf(hConsole, coordScreen);
+    }
+    else
+    {
+       ResizeConBuf(hConsole, coordScreen);
+       ResizeWindow(hConsole, srWindowRect);
     }
 }
 
index bb730f4e3f3f0c5c267976f145978fe1ffab39c1..c9b0ec4dcba60fa25f99dff0334ff33385b48cb7 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    250,
 /**/
     249,
 /**/