To: vim_dev@googlegroups.com Subject: Patch 8.0.0225 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0225 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) Files: src/ops.c, src/testdir/test_put.vim *** ../vim-8.0.0224/src/ops.c 2017-01-22 20:04:36.493131648 +0100 --- src/ops.c 2017-01-23 21:47:10.069067619 +0100 *************** *** 3774,3779 **** --- 3774,3784 ---- */ if (y_type == MCHAR && y_size == 1) { + linenr_T end = curbuf->b_visual.vi_end.lnum; + + if (curbuf->b_visual.vi_end.lnum < curbuf->b_visual.vi_start.lnum) + end = curbuf->b_visual.vi_start.lnum; + do { totlen = count * yanklen; if (totlen > 0) *************** *** 3801,3807 **** } if (VIsual_active) lnum++; ! } while (VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum); if (VIsual_active) /* reset lnum to the last visual line */ lnum--; --- 3806,3812 ---- } if (VIsual_active) lnum++; ! } while (VIsual_active && lnum <= end); if (VIsual_active) /* reset lnum to the last visual line */ lnum--; *** ../vim-8.0.0224/src/testdir/test_put.vim 2017-01-22 20:04:36.493131648 +0100 --- src/testdir/test_put.vim 2017-01-23 21:44:39.102071382 +0100 *************** *** 10,12 **** --- 10,23 ---- 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 *** ../vim-8.0.0224/src/version.c 2017-01-23 21:31:05.203482973 +0100 --- src/version.c 2017-01-23 21:46:57.653150171 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 225, /**/ -- FATHER: Did you kill all those guards? LAUNCELOT: Yes ... I'm very sorry ... FATHER: They cost fifty pounds each! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///