patch 9.1.0477: block_editing errors out when using <enter> Commit: https://github.com/vim/vim/commit/1fb9eae5794c3f808468fbc2935c5144f9e0b5b1 Author: Christian Brabandt <c...@256bit.org> Date: Tue Jun 11 20:30:14 2024 +0200
patch 9.1.0477: block_editing errors out when using <enter> Problem: block_editing errors out when using <enter> (Ali Rizvi-Santiago, after v9.1.0274) Solution: Change ins_len from size_t to int so that the test if ins_len is negative actually works properly Add a test, so that this doesn't regress. fixes: #14960 Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/ops.c b/src/ops.c index b9569571e..eb75c34b1 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1814,7 +1814,7 @@ op_change(oparg_T *oap) */ if (oap->block_mode && oap->start.lnum != oap->end.lnum && !got_int) { - size_t ins_len; + int ins_len; // Auto-indenting may have changed the indent. If the cursor was past // the indent, exclude that indent change from the inserted text. @@ -1827,7 +1827,7 @@ op_change(oparg_T *oap) bd.textcol += new_indent - pre_indent; } - ins_len = ml_get_len(oap->start.lnum) - pre_textlen; + ins_len = (int)ml_get_len(oap->start.lnum) - pre_textlen; if (ins_len > 0) { // Subsequent calls to ml_get() flush the firstline data - take a diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 95ac9a6a8..3750ebf6b 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -2705,4 +2705,13 @@ func Test_visual_block_cursor_delete() bwipe! endfunc +func Test_visual_block_cursor_insert_enter() + new + call setline(1, ['asdf asdf', 'asdf asdf', 'asdf asdf', 'asdf asdf']) + call cursor(1, 5) + exe ":norm! \<c-v>3jcw\<cr>" + call assert_equal(['asdfw', 'asdf', 'asdfasdf', 'asdfasdf', 'asdfasdf'], getline(1, '$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 12dc57596..cc2494521 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 477, /**/ 476, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/E1sH6Uj-006orF-9e%40256bit.org.