0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.0.0299: a window resize is sometimes not taking effect

Problem:    When the GUI window is resized Vim does not always take over the
            new size. (Luchr)
Solution:   Reset new_p_guifont in gui_resize_shell().  Call
            gui_may_resize_shell() in the main loop.
This commit is contained in:
Bram Moolenaar
2017-02-03 22:01:47 +01:00
parent cbf20fbcd3
commit 6b40f30329
3 changed files with 24 additions and 19 deletions

View File

@@ -1459,6 +1459,8 @@ gui_resize_shell(int pixel_width, int pixel_height)
} }
again: again:
new_pixel_width = 0;
new_pixel_height = 0;
busy = TRUE; busy = TRUE;
/* Flush pending output before redrawing */ /* Flush pending output before redrawing */
@@ -1468,8 +1470,8 @@ again:
gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height; gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height;
gui_position_components(pixel_width); gui_position_components(pixel_width);
gui_reset_scroll_region(); gui_reset_scroll_region();
/* /*
* At the "more" and ":confirm" prompt there is no redraw, put the cursor * At the "more" and ":confirm" prompt there is no redraw, put the cursor
* at the last line here (why does it have to be one row too low?). * at the last line here (why does it have to be one row too low?).
@@ -1491,17 +1493,22 @@ again:
busy = FALSE; busy = FALSE;
/* /* We may have been called again while redrawing the screen.
* We could have been called again while redrawing the screen. * Need to do it all again with the latest size then. But only if the size
* Need to do it all again with the latest size then. * actually changed. */
*/
if (new_pixel_height) if (new_pixel_height)
{ {
pixel_width = new_pixel_width; if (pixel_width == new_pixel_width && pixel_height == new_pixel_height)
pixel_height = new_pixel_height; {
new_pixel_width = 0; new_pixel_width = 0;
new_pixel_height = 0; new_pixel_height = 0;
goto again; }
else
{
pixel_width = new_pixel_width;
pixel_height = new_pixel_height;
goto again;
}
} }
} }
@@ -1511,18 +1518,10 @@ again:
void void
gui_may_resize_shell(void) gui_may_resize_shell(void)
{ {
int h, w;
if (new_pixel_height) if (new_pixel_height)
{
/* careful: gui_resize_shell() may postpone the resize again if we /* careful: gui_resize_shell() may postpone the resize again if we
* were called indirectly by it */ * were called indirectly by it */
w = new_pixel_width; gui_resize_shell(new_pixel_width, new_pixel_height);
h = new_pixel_height;
new_pixel_width = 0;
new_pixel_height = 0;
gui_resize_shell(w, h);
}
} }
int int

View File

@@ -1118,6 +1118,10 @@ main_loop(
skip_redraw = FALSE; skip_redraw = FALSE;
else if (do_redraw || stuff_empty()) else if (do_redraw || stuff_empty())
{ {
# ifdef FEAT_GUI
/* If ui_breakcheck() was used a resize may have been postponed. */
gui_may_resize_shell();
# endif
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL) #if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
/* Trigger CursorMoved if the cursor moved. */ /* Trigger CursorMoved if the cursor moved. */
if (!finish_op && ( if (!finish_op && (

View File

@@ -764,6 +764,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 */
/**/
299,
/**/ /**/
298, 298,
/**/ /**/