Skip to content

Commit

Permalink
patch 8.2.1902: default option values changed with :badd for existing…
Browse files Browse the repository at this point in the history
… 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)
  • Loading branch information
brammool committed Oct 25, 2020
1 parent 4ff2f2f commit e974fa7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ex_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
12 changes: 12 additions & 0 deletions src/testdir/test_buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1902,
/**/
1901,
/**/
Expand Down

0 comments on commit e974fa7

Please sign in to comment.