From 60670c1fd35db29a9a7a20e7ce743b8c17842172 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 13 Mar 2021 08:31:31 -0500 Subject: vim-patch:8.2.2594: alternate buffer added to session file even when it's hidden Problem: Alternate buffer added to session file even when it's hidden. Solution: Check the 'buflisted' option. (closes vim/vim#7951) https://github.com/vim/vim/commit/0756f757edba755b75e0c9c612ab2f7e673def84 N/A patches for version.c: vim-patch:8.2.2593: list of distributed files is incomplete Problem: List of distributed files is incomplete. Solution: Add a file and rename another. https://github.com/vim/vim/commit/0de8e2d6a3fae61c4d9dfdd6f16fc5040d994f6c --- src/nvim/ex_session.c | 3 ++- src/nvim/testdir/test_mksession.vim | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 63789b3981..09453e100d 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -387,9 +387,10 @@ static int put_view( if (wp->w_alt_fnum) { buf_T *const alt = buflist_findnr(wp->w_alt_fnum); - // Set the alternate file. + // Set the alternate file if the buffer is listed. if ((flagp == &ssop_flags) && alt != NULL && alt->b_fname != NULL && *alt->b_fname != NUL + && alt->b_p_bl && (fputs("balt ", fd) < 0 || ses_fname(fd, alt, flagp, true) == FAIL)) { return FAIL; diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index 7c7804212b..8486f3ff68 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -331,6 +331,20 @@ func Test_mkview_no_balt() %bwipe endfunc +func Test_mksession_no_balt() + edit Xtestfile1 + edit Xtestfile2 + + bdelete Xtestfile1 + mksession! Xtestview + + source Xtestview + call assert_equal(0, buflisted('Xtestfile1')) + + call delete('Xtestview') + %bwipe +endfunc + " Test :mkview with a file argument. func Test_mkview_file() " Create a view with line number and a fold. -- cgit From a1cdb6ca6a796b6ff5593f924659f5b707e23e27 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 13 Mar 2021 10:09:09 -0500 Subject: vim-patch:8.2.2595: setting 'winminheight' may cause 'lines' to change Problem: Setting 'winminheight' may cause 'lines' to change. Solution: Also take minimal height of other tabpages into account. (vim/vim#7899) https://github.com/vim/vim/commit/9e813b3dea94a8952b732a224fa31beba6e85973 --- src/nvim/testdir/test_options.vim | 22 ++++++++++++++++++++++ src/nvim/window.c | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 05564d2ce8..79481097ec 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -634,6 +634,28 @@ func Test_opt_winminheight_term() call delete('Xwinminheight') endfunc +func Test_opt_winminheight_term_tabs() + " See test/functional/legacy/options_spec.lua + CheckRunVimInTerminal + + " The tabline should be taken into account. + let lines =<< trim END + set wmh=0 stal=2 + split + split + split + split + tabnew + END + call writefile(lines, 'Xwinminheight') + let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11}) + call term_sendkeys(buf, ":set wmh=1\n") + call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))}) + + call StopVimInTerminal(buf) + call delete('Xwinminheight') +endfunc + " Test for setting option value containing spaces with isfname+=32 func Test_isfname_with_options() set isfname+=32 diff --git a/src/nvim/window.c b/src/nvim/window.c index 0f717a2f90..7558e0e3ba 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5501,8 +5501,8 @@ void win_setminheight(void) // loop until there is a 'winminheight' that is possible while (p_wmh > 0) { - const int room = Rows - p_ch - tabline_height(); - const int needed = frame_minheight(topframe, NULL); + const int room = Rows - p_ch; + const int needed = min_rows() - 1; // 1 was added for the cmdline if (room >= needed) { break; } -- cgit