]> granicus.if.org Git - vim/commitdiff
patch 8.2.1902: default option values changed with :badd for existing buffer v8.2.1902
authorBram Moolenaar <Bram@vim.org>
Sun, 25 Oct 2020 14:02:51 +0000 (15:02 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 25 Oct 2020 14:02:51 +0000 (15:02 +0100)
Problem:    Default option values are changed when using :badd for an existing
            buffer.
Solution:   When calling buflist_new() pass a zero line number. (closes #7195)

src/ex_cmds.c
src/testdir/test_buffer.vim
src/version.c

index 82e9c577af9a1f31127dc07a81142eff1a6d2cf2..a9be36a0c993b592d84e775ed8d0c0feb5fafc98 100644 (file)
@@ -2630,7 +2630,9 @@ do_ecmd(
        {
            if (flags & ECMD_ADDBUF)
            {
-               linenr_T        tlnum = 1L;
+               // Default the line number to zero to avoid that a wininfo item
+               // is added for the current window.
+               linenr_T        tlnum = 0;
 
                if (command != NULL)
                {
index 8ef41e20fb5b0d454e701a31e954ed878b03c87d..9ba72c5616463789e2ee3f1365b710b37628f2d6 100644 (file)
@@ -362,4 +362,16 @@ func Test_sball_with_count()
   %bw!
 endfunc
 
+func Test_badd_options()
+  new SomeNewBuffer
+  setlocal cole=3
+  wincmd p
+  badd SomeNewBuffer
+  new SomeNewBuffer
+  call assert_equal(3, &cole)
+  close
+  close
+  bwipe! SomeNewBuffer
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 5a36f0651e1e22a2b0df6125d65746de1cbb33e8..c2d6240e875bec63bfc12ca043548458eb220f2d 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1902,
 /**/
     1901,
 /**/