diff src/testdir/test_visual.vim @ 19625:f70a3c1000bb v8.2.0369

patch 8.2.0369: various Normal mode commands not fully tested Commit: https://github.com/vim/vim/commit/1671f4488105ee12a6a8558ae351436c26ab55fc Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 10 07:48:13 2020 +0100 patch 8.2.0369: various Normal mode commands not fully tested Problem: Various Normal mode commands not fully tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5751)
author Bram Moolenaar <Bram@vim.org>
date Tue, 10 Mar 2020 08:00:06 +0100
parents 9c15be376631
children 0208534b8a84
line wrap: on
line diff
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -157,11 +157,16 @@ func Test_blockwise_visual_o_O()
   exe "norm! gvO\<Esc>rb"
   exe "norm! gvo\<C-c>rc"
   exe "norm! gvO\<C-c>rd"
+  set selection=exclusive
+  exe "norm! gvOo\<C-c>re"
+  call assert_equal('...a   be.', getline(4))
+  exe "norm! gvOO\<C-c>rf"
+  set selection&
 
   call assert_equal(['..........',
         \            '...c   d..',
         \            '...     ..',
-        \            '...a   b..',
+        \            '...a   bf.',
         \            '..........'], getline(1, '$'))
 
   enew!
@@ -645,6 +650,16 @@ func Test_characterwise_select_mode()
   exe "normal Gkgh\<Down>\<End>\<Del>"
   call assert_equal(['', 'a', ''], getline(1, '$'))
 
+  " CTRL-H in select mode behaves like 'x'
+  call setline(1, 'abcdef')
+  exe "normal! gggh\<Right>\<Right>\<Right>\<C-H>"
+  call assert_equal('ef', getline(1))
+
+  " CTRL-O in select mode switches to visual mode for one command
+  call setline(1, 'abcdef')
+  exe "normal! gggh\<C-O>3lm"
+  call assert_equal('mef', getline(1))
+
   sunmap <lt>End>
   sunmap <lt>Down>
   sunmap <lt>Del>
@@ -752,8 +767,7 @@ endfunc
 func Test_visual_block_mode()
   new
   call append(0, '')
-  call setline(1, ['abcdefghijklm', 'abcdefghijklm', 'abcdefghijklm',
-        \ 'abcdefghijklm', 'abcdefghijklm'])
+  call setline(1, repeat(['abcdefghijklm'], 5))
   call cursor(1, 1)
 
   " Test shift-right of a block
@@ -772,6 +786,16 @@ func Test_visual_block_mode()
         \ 'axyzqqqqefgmnoklm',
         \ 'abcdqqqqijklm'], getline(1, 5))
 
+  " Test 'C' to change till the end of the line
+  call cursor(3, 4)
+  exe "normal! \<C-V>j3lCooo"
+  call assert_equal(['axyooo', 'axyooo'], getline(3, 4))
+
+  " Test 'D' to delete till the end of the line
+  call cursor(3, 3)
+  exe "normal! \<C-V>j2lD"
+  call assert_equal(['ax', 'ax'], getline(3, 4))
+
   bwipe!
 endfunc
 
@@ -958,8 +982,8 @@ func Test_exclusive_selection()
   close!
 endfunc
 
-" Test for starting visual mode with a count
-" This test should be run withou any previous visual modes. So this should be
+" Test for starting visual mode with a count.
+" This test should be run without any previous visual modes. So this should be
 " run as a first test.
 func Test_AAA_start_visual_mode_with_count()
   new