Skip to content

Commit 372674f

Browse files
committed
patch 8.1.1092: setting 'guifont' when maximized resizes the Vim window
Problem: Setting 'guifont' when maximized resizes the Vim window. When 'guioptions' contains "k" gvim may open with a tiny window. Solution: Avoid un-maximizing when setting 'guifont'. (Yee Cheng Chin, closes #3808)
1 parent f0908e6 commit 372674f

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/gui.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,13 @@ gui_init(void)
681681
#ifndef FEAT_GUI_GTK
682682
// Set the shell size, adjusted for the screen size. For GTK this only
683683
// works after the shell has been opened, thus it is further down.
684-
// For MS-Windows pass FALSE for "mustset" to make --windowid work.
685-
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
684+
// If the window is already maximized (e.g. when --windowid is passed in),
685+
// we want to use the system-provided dimensions by passing FALSE to
686+
// mustset. Otherwise, we want to initialize with the default rows/columns.
687+
if (gui_mch_maximized())
688+
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
689+
else
690+
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
686691
#endif
687692
#if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
688693
/* Need to set the size of the menubar after all the menus have been
@@ -721,7 +726,10 @@ gui_init(void)
721726
# endif
722727

723728
/* Now make sure the shell fits on the screen. */
724-
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
729+
if (gui_mch_maximized())
730+
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
731+
else
732+
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
725733
#endif
726734
/* When 'lines' was set while starting up the topframe may have to be
727735
* resized. */
@@ -906,7 +914,7 @@ gui_init_font(char_u *font_list, int fontset UNUSED)
906914
# endif
907915
gui_mch_set_font(gui.norm_font);
908916
#endif
909-
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
917+
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
910918
}
911919

912920
return ret;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,8 @@ static char *(features[]) =
775775

776776
static int included_patches[] =
777777
{ /* Add new patch number below this line */
778+
/**/
779+
1092,
778780
/**/
779781
1091,
780782
/**/

0 commit comments

Comments
 (0)