From: Bram Moolenaar Date: Sun, 25 Oct 2020 14:02:51 +0000 (+0100) Subject: patch 8.2.1902: default option values changed with :badd for existing buffer X-Git-Tag: v8.2.1902 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e974fa7b2b98e53a59d5ef16a6a1291f12a32e33;p=vim patch 8.2.1902: default option values changed with :badd for existing buffer 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) --- diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 82e9c577a..a9be36a0c 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -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) { diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim index 8ef41e20f..9ba72c561 100644 --- a/src/testdir/test_buffer.vim +++ b/src/testdir/test_buffer.vim @@ -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 diff --git a/src/version.c b/src/version.c index 5a36f0651..c2d6240e8 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1902, /**/ 1901, /**/