Skip to content

Commit 139348f

Browse files
committed
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)
1 parent ab65fc7 commit 139348f

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/session.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ put_view(
402402
buf_T *alt = buflist_findnr(wp->w_alt_fnum);
403403

404404
// Set the alternate file.
405-
if (alt != NULL
405+
if ((flagp == &ssop_flags)
406+
&& alt != NULL
406407
&& alt->b_fname != NULL
407408
&& *alt->b_fname != NUL
408409
&& (fputs("balt ", fd) < 0

src/testdir/test_mksession.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,20 @@ func Test_mkview_open_folds()
530530
%bwipe
531531
endfunc
532532

533+
func Test_mkview_no_balt()
534+
edit Xtestfile1
535+
edit Xtestfile2
536+
537+
mkview! Xtestview
538+
bdelete Xtestfile1
539+
540+
source Xtestview
541+
call assert_equal(0, buflisted('Xtestfile1'))
542+
543+
call delete('Xtestview')
544+
%bwipe
545+
endfunc
546+
533547
" Test :mkview with a file argument.
534548
func Test_mkview_file()
535549
" Create a view with line number and a fold.

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2467,
753755
/**/
754756
2466,
755757
/**/

0 commit comments

Comments
 (0)