Mercurial > vim
comparison src/testdir/test_visual.vim @ 24866:f1121eb17e14 v8.2.2971
patch 8.2.2971: cannot yank a block without trailing spaces
Commit: https://github.com/vim/vim/commit/544a38e44db0f25ec4fa7a2a4666cf28a2336f33
Author: Christian Brabandt <cb@256bit.org>
Date: Thu Jun 10 19:39:11 2021 +0200
patch 8.2.2971: cannot yank a block without trailing spaces
Problem: Cannot yank a block without trailing spaces.
Solution: Add the "zy" command. (Christian Brabandt, closes https://github.com/vim/vim/issues/8292)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 10 Jun 2021 19:45:02 +0200 |
parents | 4c5eec1ef612 |
children | f397a21b3e4c |
comparison
equal
deleted
inserted
replaced
24865:8dfff43cdcb8 | 24866:f1121eb17e14 |
---|---|
1169 norm! 1Gf;hzp | 1169 norm! 1Gf;hzp |
1170 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) | 1170 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) |
1171 bwipe! | 1171 bwipe! |
1172 endfunc | 1172 endfunc |
1173 | 1173 |
1174 func Test_visual_put_in_block_using_zy_and_zp() | |
1175 new | |
1176 | |
1177 " Test 1) Paste using zp - after the cursor without trailing spaces | |
1178 call setline(1, ['/path;text', '/path;text', '/path;text', '', | |
1179 \ 'texttext /subdir columntext', | |
1180 \ 'texttext /longsubdir columntext', | |
1181 \ 'texttext /longlongsubdir columntext']) | |
1182 exe "normal! 5G0f/\<c-v>2jezy" | |
1183 norm! 1G0f;hzp | |
1184 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) | |
1185 | |
1186 " Test 2) Paste using zP - in front of the cursor without trailing spaces | |
1187 %d | |
1188 call setline(1, ['/path;text', '/path;text', '/path;text', '', | |
1189 \ 'texttext /subdir columntext', | |
1190 \ 'texttext /longsubdir columntext', | |
1191 \ 'texttext /longlongsubdir columntext']) | |
1192 exe "normal! 5G0f/\<c-v>2jezy" | |
1193 norm! 1G0f;zP | |
1194 call assert_equal(['/path/subdir;text', '/path/longsubdir;text', '/path/longlongsubdir;text'], getline(1, 3)) | |
1195 | |
1196 " Test 3) Paste using p - with trailing spaces | |
1197 %d | |
1198 call setline(1, ['/path;text', '/path;text', '/path;text', '', | |
1199 \ 'texttext /subdir columntext', | |
1200 \ 'texttext /longsubdir columntext', | |
1201 \ 'texttext /longlongsubdir columntext']) | |
1202 exe "normal! 5G0f/\<c-v>2jezy" | |
1203 norm! 1G0f;hp | |
1204 call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) | |
1205 | |
1206 " Test 4) Paste using P - with trailing spaces | |
1207 %d | |
1208 call setline(1, ['/path;text', '/path;text', '/path;text', '', | |
1209 \ 'texttext /subdir columntext', | |
1210 \ 'texttext /longsubdir columntext', | |
1211 \ 'texttext /longlongsubdir columntext']) | |
1212 exe "normal! 5G0f/\<c-v>2jezy" | |
1213 norm! 1G0f;P | |
1214 call assert_equal(['/path/subdir ;text', '/path/longsubdir ;text', '/path/longlongsubdir;text'], getline(1, 3)) | |
1215 | |
1216 " Test 5) Yank with spaces inside the block | |
1217 %d | |
1218 call setline(1, ['/path;text', '/path;text', '/path;text', '', | |
1219 \ 'texttext /sub dir/ columntext', | |
1220 \ 'texttext /lon gsubdir/ columntext', | |
1221 \ 'texttext /lon glongsubdir/ columntext']) | |
1222 exe "normal! 5G0f/\<c-v>2jf/zy" | |
1223 norm! 1G0f;zP | |
1224 call assert_equal(['/path/sub dir/;text', '/path/lon gsubdir/;text', '/path/lon glongsubdir/;text'], getline(1, 3)) | |
1225 bwipe! | |
1226 endfunc | |
1227 | |
1228 | |
1174 " vim: shiftwidth=2 sts=2 expandtab | 1229 " vim: shiftwidth=2 sts=2 expandtab |