aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-01-15 19:21:17 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-01-15 19:21:17 +0800
commit87e54f123aa1c9c769d3ff35bdd1b5a980ba701c (patch)
tree1cb66900f9e0a0275c53803ca685872ddb9a294e /src/nvim/testdir
parentd391940b9a074bca7ee82460ccaaabf46b5f2ba9 (diff)
downloadrneovim-87e54f123aa1c9c769d3ff35bdd1b5a980ba701c.tar.gz
rneovim-87e54f123aa1c9c769d3ff35bdd1b5a980ba701c.tar.bz2
rneovim-87e54f123aa1c9c769d3ff35bdd1b5a980ba701c.zip
vim-patch:8.2.3280: 'virtualedit' local to buffer is not the best solution
Problem: 'virtualedit' local to buffer is not the best solution. Solution: Make it window-local. (Gary Johnson, closes vim/vim#8685) https://github.com/vim/vim/commit/51ad850f5fbafa7aa3f60affa74ec9c9f992c6cc
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_virtualedit.vim37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/nvim/testdir/test_virtualedit.vim b/src/nvim/testdir/test_virtualedit.vim
index c19a9500bd..d2a5258bd3 100644
--- a/src/nvim/testdir/test_virtualedit.vim
+++ b/src/nvim/testdir/test_virtualedit.vim
@@ -263,7 +263,7 @@ endfunc
let s:result_ve_on = 'a x'
let s:result_ve_off = 'x'
-" Utility function for Test_global_local()
+" Utility function for Test_global_local_virtualedit()
func s:TryVirtualeditReplace()
call setline(1, 'a')
normal gg7l
@@ -271,7 +271,7 @@ func s:TryVirtualeditReplace()
endfunc
" Test for :set and :setlocal
-func Test_global_local()
+func Test_global_local_virtualedit()
new
" Verify that 'virtualedit' is initialized to empty, can be set globally to
@@ -291,8 +291,8 @@ func Test_global_local()
call s:TryVirtualeditReplace()
call assert_equal(s:result_ve_off, getline(1))
- " Verify that :set affects multiple buffers
- new
+ " Verify that :set affects multiple windows.
+ split
set ve=all
call s:TryVirtualeditReplace()
call assert_equal(s:result_ve_on, getline(1))
@@ -305,17 +305,15 @@ func Test_global_local()
call assert_equal(s:result_ve_off, getline(1))
bwipe!
- " Verify that :setlocal affects only the current buffer
- setlocal ve=all
+ " Verify that :setlocal affects only the current window.
new
- call s:TryVirtualeditReplace()
- call assert_equal(s:result_ve_off, getline(1))
+ split
setlocal ve=all
- wincmd p
- setlocal ve=
- wincmd p
call s:TryVirtualeditReplace()
call assert_equal(s:result_ve_on, getline(1))
+ wincmd p
+ call s:TryVirtualeditReplace()
+ call assert_equal(s:result_ve_off, getline(1))
bwipe!
call s:TryVirtualeditReplace()
call assert_equal(s:result_ve_off, getline(1))
@@ -374,6 +372,23 @@ func Test_global_local()
bwipe!
+ " Verify that the 'virtualedit' state is copied to new windows.
+ new
+ call s:TryVirtualeditReplace()
+ call assert_equal(s:result_ve_off, getline(1))
+ split
+ setlocal ve=all
+ call s:TryVirtualeditReplace()
+ call assert_equal(s:result_ve_on, getline(1))
+ split
+ call s:TryVirtualeditReplace()
+ call assert_equal(s:result_ve_on, getline(1))
+ setlocal ve=
+ split
+ call s:TryVirtualeditReplace()
+ call assert_equal(s:result_ve_off, getline(1))
+ bwipe!
+
setlocal virtualedit&
set virtualedit&
endfunc