patch 8.0.0253: error when loading session if winminheight is 2 v8.0.0253
authorBram Moolenaar <Bram@vim.org>
Sat, 28 Jan 2017 16:11:14 +0000 (17:11 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 28 Jan 2017 16:11:14 +0000 (17:11 +0100)
Problem:    When creating a session when winminheight is 2 or larger and
            loading that session gives an error.
Solution:   Also set winminheight before setting winheight to 1. (Rafael
            Bodill, neovim #5717)

src/ex_docmd.c
src/testdir/test_mksession.vim
src/version.c

index bfb4c88d4674ecd76b8f24e7e9ed4f4ec00f519d..192f45d194b838d506f1c7b88270760e5d3fd15c 100644 (file)
@@ -11197,8 +11197,10 @@ makeopens(
         * resized when moving between windows.
         * Do this before restoring the view, so that the topline and the
         * cursor can be set.  This is done again below.
+        * winminheight and winminwidth need to be set to avoid an error if the
+        * user has set winheight or winwidth.
         */
-       if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
+       if (put_line(fd, "set winminheight=1 winheight=1 winminwidth=1 winwidth=1") == FAIL)
            return FAIL;
        if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
            return FAIL;
@@ -11268,6 +11270,10 @@ makeopens(
     if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s",
                               p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL)
        return FAIL;
+    /* Re-apply 'winminheight' and 'winminwidth'. */
+    if (fprintf(fd, "set winminheight=%ld winminwidth=%ld",
+                                     p_wmh, p_wmw) < 0 || put_eol(fd) == FAIL)
+       return FAIL;
 
     /*
      * Lastly, execute the x.vim file if it exists.
index c19f3c56a8ed9825c43e0af408b1e9a82dc7522f..77025c85442b622dbc8cb76bfaf0a112fa34f5b6 100644 (file)
@@ -101,4 +101,13 @@ func Test_mksession()
   let &wrap = wrap_save
 endfunc
 
+func Test_mksession_winheight()
+  new
+  set winheight=10 winminheight=2
+  mksession! test_mks.out
+  source test_mks.out
+
+  " call delete('test_mks.out')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 8645713b89a572a68e74dedb34c1a0ddca5b5904..19ba72e159131a753fb0a3183c8051bddd604dfc 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    253,
 /**/
     252,
 /**/