# HG changeset patch # User Bram Moolenaar # Date 1624910405 -7200 # Node ID f397a21b3e4ce5b540dfca582703553d1ef6a64f # Parent ac159f43d966482c00ffce019068ad4a6425139a patch 8.2.3072: "zy" does not work well when "virtualedit' is "block" Commit: https://github.com/vim/vim/commit/7d7bcc6ba01454c1cbb1dcbf5f11c3a4051535d6 Author: Bram Moolenaar Date: Mon Jun 28 21:54:27 2021 +0200 patch 8.2.3072: "zy" does not work well when "virtualedit' is "block" Problem: The "zy" command does not work well when 'virtualedit' is set to "block". (Johann H?chtl) Solution: Make endspaces zero. (Christian Brabandt, closes #8468, closes #8448) diff --git a/src/register.c b/src/register.c --- a/src/register.c +++ b/src/register.c @@ -1455,6 +1455,8 @@ yank_copy_line(struct block_def *bd, lon { char_u *pnew; + if (exclude_trailing_space) + bd->endspaces = 0; if ((pnew = alloc(bd->startspaces + bd->endspaces + bd->textlen + 1)) == NULL) return FAIL; @@ -2747,7 +2749,7 @@ write_reg_contents_lst( &yank_type) == FAIL) return; - str_to_reg(y_current, yank_type, (char_u *) strings, -1, block_len, TRUE); + str_to_reg(y_current, yank_type, (char_u *)strings, -1, block_len, TRUE); finish_write_reg(name, old_y_previous, old_y_current); } diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1,6 +1,7 @@ " Tests for various Visual modes. source shared.vim +source check.vim func Test_block_shift_multibyte() " Uses double-wide character. @@ -1225,5 +1226,24 @@ func Test_visual_put_in_block_using_zy_a bwipe! endfunc +func Test_visual_put_blockedit_zy_and_zp() + new + + call setline(1, ['aa', 'bbbbb', 'ccc', '', 'XX', 'GGHHJ', 'RTZU']) + exe "normal! gg0\2j$zy" + norm! 5gg0zP + call assert_equal(['aa', 'bbbbb', 'ccc', '', 'aaXX', 'bbbbbGGHHJ', 'cccRTZU'], getline(1, 7)) + " + " now with blockmode editing + sil %d + :set ve=block + call setline(1, ['aa', 'bbbbb', 'ccc', '', 'XX', 'GGHHJ', 'RTZU']) + exe "normal! gg0\2j$zy" + norm! 5gg0zP + call assert_equal(['aa', 'bbbbb', 'ccc', '', 'aaXX', 'bbbbbGGHHJ', 'cccRTZU'], getline(1, 7)) + set ve&vim + bw! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3072, +/**/ 3071, /**/ 3070,