aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
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