aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-13 13:34:43 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-13 13:40:09 -0500
commit9860d14af367be03c9588beb39edf37c16c84375 (patch)
tree62187163be15b3445b779b2356dfea382f63dc79 /src
parent5ad32885d461e8ace052397b251f25fae24189a3 (diff)
downloadrneovim-9860d14af367be03c9588beb39edf37c16c84375.tar.gz
rneovim-9860d14af367be03c9588beb39edf37c16c84375.tar.bz2
rneovim-9860d14af367be03c9588beb39edf37c16c84375.zip
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 vim/vim#7195) https://github.com/vim/vim/commit/e974fa7b2b98e53a59d5ef16a6a1291f12a32e33
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