diff options
author | Christian Brabandt <cb@256bit.org> | 2021-06-10 19:39:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-10 19:39:11 +0200 |
commit | 544a38e44db0f25ec4fa7a2a4666cf28a2336f33 (patch) | |
tree | aa6a3da517185bbdb604f7d31bde07ef4dc36c31 /src/testdir/test_visual.vim | |
parent | 31e299c08f250b126b2c2c0ecce12ee563b70fdc (diff) |
patch 8.2.2971: cannot yank a block without trailing spacesv8.2.2971
Problem: Cannot yank a block without trailing spaces.
Solution: Add the "zy" command. (Christian Brabandt, closes #8292)
Diffstat (limited to 'src/testdir/test_visual.vim')
-rw-r--r-- | src/testdir/test_visual.vim | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 51ef5ae812..fb26750829 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1171,4 +1171,59 @@ func Test_visual_put_in_block_using_zp() bwipe! endfunc +func Test_visual_put_in_block_using_zy_and_zp() + new + + " Test 1) Paste using zp - after the cursor without trailing spaces + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;hzp + call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 2) Paste using zP - in front of the cursor without trailing spaces + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;zP + call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 3) Paste using p - with trailing spaces + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;hp + call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 4) Paste using P - with trailing spaces + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /subdir columntext', + \ 'texttext /longsubdir columntext', + \ 'texttext /longlongsubdir columntext']) + exe "normal! 5G0f/\<c-v>2jezy" + norm! 1G0f;P + call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) + + " Test 5) Yank with spaces inside the block + %d + call setline(1, ['/path;text', '/path;text', '/path;text', '', + \ 'texttext /sub dir/ columntext', + \ 'texttext /lon gsubdir/ columntext', + \ 'texttext /lon glongsubdir/ columntext']) + exe "normal! 5G0f/\<c-v>2jf/zy" + norm! 1G0f;zP + call assert_equal(['/path/sub dir/;text', '/path/lon gsubdir/;text', '/path/lon glongsubdir/;text'], getline(1, 3)) + bwipe! +endfunc + + " vim: shiftwidth=2 sts=2 expandtab |