]> granicus.if.org Git - vim/commitdiff
patch 8.2.2467: script generated by :mkview changes alternate file v8.2.2467
authorBram Moolenaar <Bram@vim.org>
Fri, 5 Feb 2021 20:55:53 +0000 (21:55 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 5 Feb 2021 20:55:53 +0000 (21:55 +0100)
Problem:    Script generated by :mkview changes alternate file.
Solution:   Only write :balt in the session file. (Harish Rajagopal,
            closes #7779)

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

index d0373bb39446fec640d77297ccbb392c1e056d66..a734656d54d7d955093d96e24d438c9f28cdb448 100644 (file)
@@ -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
index 82c96ce6396a836cd8a6c80c821de13f92420f67..eb8c6a5a46113f9ab18c2824ae2a7f89a6957721 100644 (file)
@@ -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.
index 0ea7fb4493a69fd76347fe03dfea547204ba933f..df206d1ccbcfc698d41808240aa0cef5dc9bfa51 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2467,
 /**/
     2466,
 /**/