Skip to content

Commit e974fa7

Browse files
committed
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)
1 parent 4ff2f2f commit e974fa7

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/ex_cmds.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2630,7 +2630,9 @@ do_ecmd(
26302630
{
26312631
if (flags & ECMD_ADDBUF)
26322632
{
2633-
linenr_T tlnum = 1L;
2633+
// Default the line number to zero to avoid that a wininfo item
2634+
// is added for the current window.
2635+
linenr_T tlnum = 0;
26342636

26352637
if (command != NULL)
26362638
{

src/testdir/test_buffer.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,16 @@ func Test_sball_with_count()
362362
%bw!
363363
endfunc
364364

365+
func Test_badd_options()
366+
new SomeNewBuffer
367+
setlocal cole=3
368+
wincmd p
369+
badd SomeNewBuffer
370+
new SomeNewBuffer
371+
call assert_equal(3, &cole)
372+
close
373+
close
374+
bwipe! SomeNewBuffer
375+
endfunc
376+
365377
" vim: shiftwidth=2 sts=2 expandtab

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+
1902,
753755
/**/
754756
1901,
755757
/**/

0 commit comments

Comments
 (0)