aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/testdir/test_buffer.vim12
2 files changed, 15 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index a994d0d8c3..bf9fc6f187 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2324,7 +2324,9 @@ int do_ecmd(
buf = buflist_findnr(fnum);
} else {
if (flags & (ECMD_ADDBUF | ECMD_ALTBUF)) {
- 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) {
tlnum = atol((char *)command);
diff --git a/src/nvim/testdir/test_buffer.vim b/src/nvim/testdir/test_buffer.vim
index f455b6911f..d4165f0008 100644
--- a/src/nvim/testdir/test_buffer.vim
+++ b/src/nvim/testdir/test_buffer.vim
@@ -1,5 +1,17 @@
" Tests for Vim buffer
+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
+
func Test_balt()
new SomeNewBuffer
balt +3 OtherBuffer