Mercurial > vim
changeset 23851:a2f13e56b0e7 v8.2.2467
patch 8.2.2467: script generated by :mkview changes alternate file
Commit: https://github.com/vim/vim/commit/139348f3e8370826a1ceb10c73f7c7bb586f8125
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 5 21:55:53 2021 +0100
patch 8.2.2467: script generated by :mkview changes alternate file
Problem: Script generated by :mkview changes alternate file.
Solution: Only write :balt in the session file. (Harish Rajagopal,
closes #7779)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 05 Feb 2021 22:00:05 +0100 |
parents | e3e337ea300b |
children | cbebf5f1a5a7 |
files | src/session.c src/testdir/test_mksession.vim src/version.c |
diffstat | 3 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/session.c +++ b/src/session.c @@ -402,7 +402,8 @@ put_view( buf_T *alt = buflist_findnr(wp->w_alt_fnum); // Set the alternate file. - if (alt != NULL + if ((flagp == &ssop_flags) + && alt != NULL && alt->b_fname != NULL && *alt->b_fname != NUL && (fputs("balt ", fd) < 0
--- a/src/testdir/test_mksession.vim +++ b/src/testdir/test_mksession.vim @@ -530,6 +530,20 @@ func Test_mkview_open_folds() %bwipe endfunc +func Test_mkview_no_balt() + edit Xtestfile1 + edit Xtestfile2 + + mkview! Xtestview + bdelete Xtestfile1 + + 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.