aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-11-13 19:55:20 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2018-06-21 22:41:15 +0200
commit8917e0c3010f93d6238bda21c4807c6c5921eb4a (patch)
treecac3120a95f3e49f6bcbc882c462c6e3f29905cd /src/nvim/testdir
parent7ae7da8fb9ab2e23ffc19000798ae27a2dee4e87 (diff)
downloadrneovim-8917e0c3010f93d6238bda21c4807c6c5921eb4a.tar.gz
rneovim-8917e0c3010f93d6238bda21c4807c6c5921eb4a.tar.bz2
rneovim-8917e0c3010f93d6238bda21c4807c6c5921eb4a.zip
buffer: fix copying setl options for buffer currently displayed in another window
vim-patch:8.0.1836: buffer-local window options may not be recent Problem: Buffer-local window options may not be recent if the buffer is still open in another window. Solution: Copy the options from the window instead of the outdated window options. (Bjorn Linse, closes vim/vim#2336) https://github.com/vim/vim/commit/25782a7ff4755daf16c2e1cb5e5f826b13b672ce
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_options.vim52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index d9cd5fd583..f0aec42ae1 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -287,3 +287,55 @@ func Test_set_indentexpr()
call assert_equal('', &indentexpr)
bwipe!
endfunc
+
+func Test_copy_winopt()
+ set hidden
+
+ " Test copy option from current buffer in window
+ split
+ enew
+ setlocal numberwidth=5
+ wincmd w
+ call assert_equal(4,&numberwidth)
+ bnext
+ call assert_equal(5,&numberwidth)
+ bw!
+ call assert_equal(4,&numberwidth)
+
+ " Test copy value from window that used to be display the buffer
+ split
+ enew
+ setlocal numberwidth=6
+ bnext
+ wincmd w
+ call assert_equal(4,&numberwidth)
+ bnext
+ call assert_equal(6,&numberwidth)
+ bw!
+
+ " Test that if buffer is current, don't use the stale cached value
+ " from the last time the buffer was displayed.
+ split
+ enew
+ setlocal numberwidth=7
+ bnext
+ bnext
+ setlocal numberwidth=8
+ wincmd w
+ call assert_equal(4,&numberwidth)
+ bnext
+ call assert_equal(8,&numberwidth)
+ bw!
+
+ " Test value is not copied if window already has seen the buffer
+ enew
+ split
+ setlocal numberwidth=9
+ bnext
+ setlocal numberwidth=10
+ wincmd w
+ call assert_equal(4,&numberwidth)
+ bnext
+ call assert_equal(4,&numberwidth)
+ bw!
+endfunc