]> granicus.if.org Git - vim/commitdiff
patch 8.2.1232: MS-Windows GUI: Snap cancelled by split command v8.2.1232
authorBram Moolenaar <Bram@vim.org>
Fri, 17 Jul 2020 20:26:53 +0000 (22:26 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 Jul 2020 20:26:53 +0000 (22:26 +0200)
Problem:    MS-Windows GUI: Snap cancelled by split command.
Solution:   Do not cancel Snap when splitting a window. (Ken Takata,
            closes #6467)

src/gui_w32.c
src/version.c

index 46358dc13194acebcb2f8d99a8706b1b0690a6cc..19db1a33ad3e73993b7177b56837091dab4115dd 100644 (file)
@@ -3342,19 +3342,33 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED)
 
 /*
  * Return TRUE if the GUI window is maximized, filling the whole screen.
+ * Also return TRUE if the window is snapped.
  */
     int
 gui_mch_maximized(void)
 {
     WINDOWPLACEMENT wp;
+    RECT           rc;
 
     wp.length = sizeof(WINDOWPLACEMENT);
     if (GetWindowPlacement(s_hwnd, &wp))
-       return wp.showCmd == SW_SHOWMAXIMIZED
+    {
+       if (wp.showCmd == SW_SHOWMAXIMIZED
            || (wp.showCmd == SW_SHOWMINIMIZED
-                   && wp.flags == WPF_RESTORETOMAXIMIZED);
-
-    return 0;
+                   && wp.flags == WPF_RESTORETOMAXIMIZED))
+           return TRUE;
+       if (wp.showCmd == SW_SHOWMINIMIZED)
+           return FALSE;
+
+       // Assume the window is snapped when the sizes from two APIs differ.
+       GetWindowRect(s_hwnd, &rc);
+       if ((rc.right - rc.left !=
+                   wp.rcNormalPosition.right - wp.rcNormalPosition.left)
+               || (rc.bottom - rc.top !=
+                   wp.rcNormalPosition.bottom - wp.rcNormalPosition.top))
+           return TRUE;
+    }
+    return FALSE;
 }
 
 /*
index 68c1e820c4d8619373f2e7b9884dd6f47e0e68cb..659b6932b90a14dc0e6dffec815cc7907c6644c3 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1232,
 /**/
     1231,
 /**/