From ec02d9aad6b3015b1802476521a65234c70b0574 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Wed, 21 Feb 2018 04:44:37 +0800 Subject: vim-patch:8.0.0222: blockwise put on multi-byte char (#8030) Note: code change was covered by c2a18216114bae75b6d6a2c7f1a68db04578abce Problem: When a multi-byte character ends in a zero byte, putting blockwise text puts it before the character instead of after it. Solution: Use int instead of char for the character under the cursor. (Luchr, closes vim/vim#1403) Add a test. https://github.com/vim/vim/commit/c81299684b2b9045e56525d3da3f45e8440fbf0d --- src/nvim/testdir/test_put.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/nvim/testdir/test_put.vim (limited to 'src/nvim/testdir/test_put.vim') diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim new file mode 100644 index 0000000000..612bdabb6c --- /dev/null +++ b/src/nvim/testdir/test_put.vim @@ -0,0 +1,12 @@ + +func Test_put_block() + if !has('multi_byte') + return + endif + new + call feedkeys("i\u2500\x\", 'x') + call feedkeys("\y", 'x') + call feedkeys("gg0p", 'x') + call assert_equal("\u2500x", getline(1)) + bwipe! +endfunc -- cgit From 4a8f0819715c0c355fba6f61304fd44fb4650d55 Mon Sep 17 00:00:00 2001 From: UTkarsh Maheshwari Date: Thu, 22 Feb 2018 02:26:47 +0530 Subject: vim-patch:8.0.0225: put in Visual block mode terminates early (#8040) Problem: When a block is visually selected and put is used on the end of the selection only one line is changed. Solution: Check for the end properly. (Christian Brabandt, neovim issue 5781) https://github.com/vim/vim/commit/9957a10d0f0c34d8083af6ed66e198e4796038e0 --- src/nvim/testdir/test_put.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nvim/testdir/test_put.vim') diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim index 612bdabb6c..0154de1ec0 100644 --- a/src/nvim/testdir/test_put.vim +++ b/src/nvim/testdir/test_put.vim @@ -10,3 +10,14 @@ func Test_put_block() call assert_equal("\u2500x", getline(1)) bwipe! endfunc + +func Test_put_char_block() + new + call setline(1, ['Line 1', 'Line 2']) + f Xfile_put + " visually select both lines and put the cursor at the top of the visual + " selection and then put the buffer name over it + exe "norm! G0\ke\"%p" + call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2)) + bw! +endfunc -- cgit From 544cef0155ecb006c34e8471733cac6bdfd61989 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Sun, 4 Mar 2018 22:53:50 +0800 Subject: vim-patch:8.0.0234,8.0.0236,8.0.0225 (#8052) vim-patch:8.0.0234: crash when using put in Visual mode Problem: When several lines are visually selected and one of them is short, using put may cause a crash. (Axel Bender) Solution: Check for a short line. (Christian Brabandt) https://github.com/vim/vim/commit/941c12da3c087fd04aa6c120a76bf28f19349d96 vim-patch:8.0.0236: gcc complains about uninitialized variable Problem: Gcc complains that a variable may be used uninitialized. Confusion between variable and label name. (John Marriott) Solution: Initialize it. Rename end to end_lnum. https://github.com/vim/vim/commit/6a717f17ec6b09634be1c29e0ac4c35213f7b32d vim-patch:8.0.0225: put in Visual block mode terminates early Problem: When a block is visually selected and put is used on the end of the selection only one line is changed. Solution: Check for the end properly. (Christian Brabandt, neovim issue 5781) https://github.com/vim/vim/commit/9957a10d0f0c34d8083af6ed66e198e4796038e0 --- src/nvim/testdir/test_put.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/nvim/testdir/test_put.vim') diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim index 0154de1ec0..38c812bc9c 100644 --- a/src/nvim/testdir/test_put.vim +++ b/src/nvim/testdir/test_put.vim @@ -21,3 +21,16 @@ func Test_put_char_block() call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2)) bw! endfunc + +func Test_put_char_block2() + new + let a = [ getreg('a'), getregtype('a') ] + call setreg('a', ' one ', 'v') + call setline(1, ['Line 1', '', 'Line 3', '']) + " visually select the first 3 lines and put register a over it + exe "norm! ggl\2j2l\"ap" + call assert_equal(['L one 1', '', 'L one 3', ''], getline(1,4)) + " clean up + bw! + call setreg('a', a[0], a[1]) +endfunc -- cgit