summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-02-03 22:01:47 +0100
committerBram Moolenaar <Bram@vim.org>2017-02-03 22:01:47 +0100
commit6b40f303291be6b2fe524b5708e089773048c269 (patch)
treeb1218afefdd00a14509c86fbefe601596bd97de7
parentcbf20fbcd3e9bb006f694bcc35da859930fb12a2 (diff)
patch 8.0.0299: a window resize is sometimes not taking effectv8.0.0299
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.
-rw-r--r--src/gui.c37
-rw-r--r--src/main.c4
-rw-r--r--src/version.c2
3 files changed, 24 insertions, 19 deletions
diff --git a/src/gui.c b/src/gui.c
index 87b0839586..203035f5d2 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1459,6 +1459,8 @@ gui_resize_shell(int pixel_width, int pixel_height)
}
again:
+ new_pixel_width = 0;
+ new_pixel_height = 0;
busy = TRUE;
/* Flush pending output before redrawing */
@@ -1468,8 +1470,8 @@ again:
gui.num_rows = (pixel_height - gui_get_base_height()) / gui.char_height;
gui_position_components(pixel_width);
-
gui_reset_scroll_region();
+
/*
* 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?).
@@ -1491,17 +1493,22 @@ again:
busy = FALSE;
- /*
- * We could have been called again while redrawing the screen.
- * Need to do it all again with the latest size then.
- */
+ /* We may have been called again while redrawing the screen.
+ * Need to do it all again with the latest size then. But only if the size
+ * actually changed. */
if (new_pixel_height)
{
- pixel_width = new_pixel_width;
- pixel_height = new_pixel_height;
- new_pixel_width = 0;
- new_pixel_height = 0;
- goto again;
+ if (pixel_width == new_pixel_width && pixel_height == new_pixel_height)
+ {
+ new_pixel_width = 0;
+ new_pixel_height = 0;
+ }
+ else
+ {
+ pixel_width = new_pixel_width;
+ pixel_height = new_pixel_height;
+ goto again;
+ }
}
}
@@ -1511,18 +1518,10 @@ again:
void
gui_may_resize_shell(void)
{
- int h, w;
-
if (new_pixel_height)
- {
/* careful: gui_resize_shell() may postpone the resize again if we
* were called indirectly by it */
- w = new_pixel_width;
- h = new_pixel_height;
- new_pixel_width = 0;
- new_pixel_height = 0;
- gui_resize_shell(w, h);
- }
+ gui_resize_shell(new_pixel_width, new_pixel_height);
}
int
diff --git a/src/main.c b/src/main.c
index f3c471a852..0ed94ae907 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1118,6 +1118,10 @@ main_loop(
skip_redraw = FALSE;
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)
/* Trigger CursorMoved if the cursor moved. */
if (!finish_op && (
diff --git a/src/version.c b/src/version.c
index 93a59cd635..fa51e56944 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 299,
+/**/
298,
/**/
297,