]> granicus.if.org Git - vim/commitdiff
patch 8.2.4315: put in Visual mode not fully tested v8.2.4315
authorzeertzjq <zeertzjq@outlook.com>
Mon, 7 Feb 2022 10:33:20 +0000 (10:33 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Feb 2022 10:33:20 +0000 (10:33 +0000)
Problem:    Put in Visual mode not fully tested.
Solution:   Add a few more test cases. (closes #9708)

src/testdir/test_visual.vim
src/version.c

index d336f5b38a439133635d9be663f5a914e4539cee..3fbd5c7e4e17d86764581f788d8f1e7213fdc7bb 100644 (file)
@@ -1369,18 +1369,52 @@ func Test_visual_paste()
   call setline(1, ['xxxx'])
   call setreg('"', 'foo')
   call setreg('-', 'bar')
-  normal 1Gvp
-  call assert_equal(@", 'x')
-  call assert_equal(@-, 'x')
+  normal gg0vp
+  call assert_equal('x', @")
+  call assert_equal('x', @-)
+  call assert_equal('fooxxx', getline(1))
+  normal $vp
+  call assert_equal('x', @")
+  call assert_equal('x', @-)
+  call assert_equal('fooxxx', getline(1))
+  " Test with a different register as unnamed register.
+  call setline(2, ['baz'])
+  normal 2gg0"rD
+  call assert_equal('baz', @")
+  normal gg0vp
+  call assert_equal('f', @")
+  call assert_equal('f', @-)
+  call assert_equal('bazooxxx', getline(1))
+  normal $vp
+  call assert_equal('x', @")
+  call assert_equal('x', @-)
+  call assert_equal('bazooxxf', getline(1))
 
   if has('clipboard')
     " v_P does not overwrite unnamed register.
     call setline(1, ['xxxx'])
     call setreg('"', 'foo')
     call setreg('-', 'bar')
-    normal 1GvP
-    call assert_equal(@", 'foo')
-    call assert_equal(@-, 'x')
+    normal gg0vP
+    call assert_equal('foo', @")
+    call assert_equal('x', @-)
+    call assert_equal('fooxxx', getline(1))
+    normal $vP
+    call assert_equal('foo', @")
+    call assert_equal('x', @-)
+    call assert_equal('fooxxfoo', getline(1))
+    " Test with a different register as unnamed register.
+    call setline(2, ['baz'])
+    normal 2gg0"rD
+    call assert_equal('baz', @")
+    normal gg0vP
+    call assert_equal('baz', @")
+    call assert_equal('f', @-)
+    call assert_equal('bazooxxfoo', getline(1))
+    normal $vP
+    call assert_equal('baz', @")
+    call assert_equal('o', @-)
+    call assert_equal('bazooxxfobaz', getline(1))
   endif
 
   bwipe!
index a071c5f678569ea14f5ea3be9607c28d58bc84e4..8d0dececd1e21568fcc1be15b3e3cb9e5df9da2c 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4315,
 /**/
     4314,
 /**/