forked from aniani/vim
patch 8.0.1278: GUI window always resizes when adding scrollbar
Problem: GUI window always resizes when adding/removing a scrollbar, toolbar, etc. Solution: Add the 'k' flag in 'guioptions' to keep the GUI window size and change the number of lines/columns instead. (Ychin, closes #703)
This commit is contained in:
@@ -3939,7 +3939,13 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
removing it after the GUI has started has no effect.
|
removing it after the GUI has started has no effect.
|
||||||
*'go-F'*
|
*'go-F'*
|
||||||
'F' Add a footer. Only for Motif. See |gui-footer|.
|
'F' Add a footer. Only for Motif. See |gui-footer|.
|
||||||
|
*'go-k'*
|
||||||
|
'k' Keep the GUI window size when adding/removing a scrollbar, or
|
||||||
|
toolbar, tabline, etc. Instead, the behavior is similar to
|
||||||
|
when the window is maximized and will adjust 'lines' and
|
||||||
|
'columns' to fit to the window. Without the 'k' flag Vim will
|
||||||
|
try to keep 'lines' and 'columns the same when adding and
|
||||||
|
removing GUI components.
|
||||||
|
|
||||||
*'guipty'* *'noguipty'*
|
*'guipty'* *'noguipty'*
|
||||||
'guipty' boolean (default on)
|
'guipty' boolean (default on)
|
||||||
|
13
src/gui.c
13
src/gui.c
@@ -693,7 +693,7 @@ gui_init(void)
|
|||||||
#ifndef FEAT_GUI_GTK
|
#ifndef FEAT_GUI_GTK
|
||||||
/* Set the shell size, adjusted for the screen size. For GTK this only
|
/* Set the shell size, adjusted for the screen size. For GTK this only
|
||||||
* works after the shell has been opened, thus it is further down. */
|
* works after the shell has been opened, thus it is further down. */
|
||||||
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
|
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
|
||||||
#endif
|
#endif
|
||||||
#if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
|
#if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
|
||||||
/* Need to set the size of the menubar after all the menus have been
|
/* Need to set the size of the menubar after all the menus have been
|
||||||
@@ -732,7 +732,7 @@ gui_init(void)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Now make sure the shell fits on the screen. */
|
/* Now make sure the shell fits on the screen. */
|
||||||
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
|
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
|
||||||
#endif
|
#endif
|
||||||
/* When 'lines' was set while starting up the topframe may have to be
|
/* When 'lines' was set while starting up the topframe may have to be
|
||||||
* resized. */
|
* resized. */
|
||||||
@@ -909,7 +909,7 @@ gui_init_font(char_u *font_list, int fontset UNUSED)
|
|||||||
# endif
|
# endif
|
||||||
gui_mch_set_font(gui.norm_font);
|
gui_mch_set_font(gui.norm_font);
|
||||||
#endif
|
#endif
|
||||||
gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
|
gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1553,10 +1553,12 @@ gui_get_shellsize(void)
|
|||||||
* Set the size of the Vim shell according to Rows and Columns.
|
* Set the size of the Vim shell according to Rows and Columns.
|
||||||
* If "fit_to_display" is TRUE then the size may be reduced to fit the window
|
* If "fit_to_display" is TRUE then the size may be reduced to fit the window
|
||||||
* on the screen.
|
* on the screen.
|
||||||
|
* When "mustset" is TRUE the size was set by the user. When FALSE a UI
|
||||||
|
* component was added or removed (e.g., a scrollbar).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gui_set_shellsize(
|
gui_set_shellsize(
|
||||||
int mustset UNUSED, /* set by the user */
|
int mustset UNUSED,
|
||||||
int fit_to_display,
|
int fit_to_display,
|
||||||
int direction) /* RESIZE_HOR, RESIZE_VER */
|
int direction) /* RESIZE_HOR, RESIZE_VER */
|
||||||
{
|
{
|
||||||
@@ -1580,7 +1582,8 @@ gui_set_shellsize(
|
|||||||
#if defined(MSWIN) || defined(FEAT_GUI_GTK)
|
#if defined(MSWIN) || defined(FEAT_GUI_GTK)
|
||||||
/* If not setting to a user specified size and maximized, calculate the
|
/* If not setting to a user specified size and maximized, calculate the
|
||||||
* number of characters that fit in the maximized window. */
|
* number of characters that fit in the maximized window. */
|
||||||
if (!mustset && gui_mch_maximized())
|
if (!mustset && (vim_strchr(p_go, GO_KEEPWINSIZE) != NULL
|
||||||
|
|| gui_mch_maximized()))
|
||||||
{
|
{
|
||||||
gui_mch_newfont();
|
gui_mch_newfont();
|
||||||
return;
|
return;
|
||||||
|
@@ -2938,7 +2938,7 @@ mainwin_screen_changed_cb(GtkWidget *widget,
|
|||||||
if (gui.norm_font != NULL)
|
if (gui.norm_font != NULL)
|
||||||
{
|
{
|
||||||
gui_mch_init_font(p_guifont, FALSE);
|
gui_mch_init_font(p_guifont, FALSE);
|
||||||
gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH);
|
gui_set_shellsize(TRUE, FALSE, RESIZE_BOTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4909,8 +4909,9 @@ gui_mch_unmaximize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when the font changed while the window is maximized. Compute the
|
* Called when the font changed while the window is maximized or GO_KEEPWINSIZE
|
||||||
* new Rows and Columns. This is like resizing the window.
|
* is set. Compute the new Rows and Columns. This is like resizing the
|
||||||
|
* window.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gui_mch_newfont(void)
|
gui_mch_newfont(void)
|
||||||
|
@@ -3385,8 +3385,9 @@ gui_mch_maximized(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when the font changed while the window is maximized. Compute the
|
* Called when the font changed while the window is maximized or GO_KEEPWINSIZE
|
||||||
* new Rows and Columns. This is like resizing the window.
|
* is set. Compute the new Rows and Columns. This is like resizing the
|
||||||
|
* window.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gui_mch_newfont(void)
|
gui_mch_newfont(void)
|
||||||
|
@@ -235,7 +235,8 @@
|
|||||||
#define GO_TOOLBAR 'T' /* add toolbar */
|
#define GO_TOOLBAR 'T' /* add toolbar */
|
||||||
#define GO_FOOTER 'F' /* add footer */
|
#define GO_FOOTER 'F' /* add footer */
|
||||||
#define GO_VERTICAL 'v' /* arrange dialog buttons vertically */
|
#define GO_VERTICAL 'v' /* arrange dialog buttons vertically */
|
||||||
#define GO_ALL "aAbcefFghilmMprtTv" /* all possible flags for 'go' */
|
#define GO_KEEPWINSIZE 'k' /* keep GUI window size */
|
||||||
|
#define GO_ALL "aAbcefFghilmMprtTvk" /* all possible flags for 'go' */
|
||||||
|
|
||||||
/* flags for 'comments' option */
|
/* flags for 'comments' option */
|
||||||
#define COM_NEST 'n' /* comments strings nest */
|
#define COM_NEST 'n' /* comments strings nest */
|
||||||
|
@@ -761,6 +761,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 */
|
||||||
|
/**/
|
||||||
|
1278,
|
||||||
/**/
|
/**/
|
||||||
1277,
|
1277,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user