Skip to content

Commit 36ae89c

Browse files
committed
patch 8.0.0253: error when loading session if winminheight is 2
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)
1 parent 4019cf9 commit 36ae89c

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/ex_docmd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11197,8 +11197,10 @@ makeopens(
1119711197
* resized when moving between windows.
1119811198
* Do this before restoring the view, so that the topline and the
1119911199
* cursor can be set. This is done again below.
11200+
* winminheight and winminwidth need to be set to avoid an error if the
11201+
* user has set winheight or winwidth.
1120011202
*/
11201-
if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
11203+
if (put_line(fd, "set winminheight=1 winheight=1 winminwidth=1 winwidth=1") == FAIL)
1120211204
return FAIL;
1120311205
if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
1120411206
return FAIL;
@@ -11268,6 +11270,10 @@ makeopens(
1126811270
if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s",
1126911271
p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL)
1127011272
return FAIL;
11273+
/* Re-apply 'winminheight' and 'winminwidth'. */
11274+
if (fprintf(fd, "set winminheight=%ld winminwidth=%ld",
11275+
p_wmh, p_wmw) < 0 || put_eol(fd) == FAIL)
11276+
return FAIL;
1127111277

1127211278
/*
1127311279
* Lastly, execute the x.vim file if it exists.

src/testdir/test_mksession.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,13 @@ func Test_mksession()
101101
let &wrap = wrap_save
102102
endfunc
103103

104+
func Test_mksession_winheight()
105+
new
106+
set winheight=10 winminheight=2
107+
mksession! test_mks.out
108+
source test_mks.out
109+
110+
" call delete('test_mks.out')
111+
endfunc
112+
104113
" vim: shiftwidth=2 sts=2 expandtab

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+
253,
767769
/**/
768770
252,
769771
/**/

0 commit comments

Comments
 (0)