Skip to content

Commit 6b40f30

Browse files
committed
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.
1 parent cbf20fb commit 6b40f30

3 files changed

Lines changed: 24 additions & 19 deletions

File tree

src/gui.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,8 @@ gui_resize_shell(int pixel_width, int pixel_height)
14591459
}
14601460

14611461
again:
1462+
new_pixel_width = 0;
1463+
new_pixel_height = 0;
14621464
busy = TRUE;
14631465

14641466
/* Flush pending output before redrawing */
@@ -1468,8 +1470,8 @@ gui_resize_shell(int pixel_width, int pixel_height)
14681470
gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height;
14691471

14701472
gui_position_components(pixel_width);
1471-
14721473
gui_reset_scroll_region();
1474+
14731475
/*
14741476
* At the "more" and ":confirm" prompt there is no redraw, put the cursor
14751477
* at the last line here (why does it have to be one row too low?).
@@ -1491,17 +1493,22 @@ gui_resize_shell(int pixel_width, int pixel_height)
14911493

14921494
busy = FALSE;
14931495

1494-
/*
1495-
* We could have been called again while redrawing the screen.
1496-
* Need to do it all again with the latest size then.
1497-
*/
1496+
/* We may have been called again while redrawing the screen.
1497+
* Need to do it all again with the latest size then. But only if the size
1498+
* actually changed. */
14981499
if (new_pixel_height)
14991500
{
1500-
pixel_width = new_pixel_width;
1501-
pixel_height = new_pixel_height;
1502-
new_pixel_width = 0;
1503-
new_pixel_height = 0;
1504-
goto again;
1501+
if (pixel_width == new_pixel_width && pixel_height == new_pixel_height)
1502+
{
1503+
new_pixel_width = 0;
1504+
new_pixel_height = 0;
1505+
}
1506+
else
1507+
{
1508+
pixel_width = new_pixel_width;
1509+
pixel_height = new_pixel_height;
1510+
goto again;
1511+
}
15051512
}
15061513
}
15071514

@@ -1511,18 +1518,10 @@ gui_resize_shell(int pixel_width, int pixel_height)
15111518
void
15121519
gui_may_resize_shell(void)
15131520
{
1514-
int h, w;
1515-
15161521
if (new_pixel_height)
1517-
{
15181522
/* careful: gui_resize_shell() may postpone the resize again if we
15191523
* were called indirectly by it */
1520-
w = new_pixel_width;
1521-
h = new_pixel_height;
1522-
new_pixel_width = 0;
1523-
new_pixel_height = 0;
1524-
gui_resize_shell(w, h);
1525-
}
1524+
gui_resize_shell(new_pixel_width, new_pixel_height);
15261525
}
15271526

15281527
int

src/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,10 @@ main_loop(
11181118
skip_redraw = FALSE;
11191119
else if (do_redraw || stuff_empty())
11201120
{
1121+
# ifdef FEAT_GUI
1122+
/* If ui_breakcheck() was used a resize may have been postponed. */
1123+
gui_may_resize_shell();
1124+
# endif
11211125
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
11221126
/* Trigger CursorMoved if the cursor moved. */
11231127
if (!finish_op && (

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
299,
767769
/**/
768770
298,
769771
/**/

0 commit comments

Comments
 (0)