diff options
author | Christian Brabandt <cb@256bit.org> | 2024-01-22 20:12:34 +0100 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-01-22 20:12:34 +0100 |
commit | 7c71db3a58f658b4329b82ab603efa928d17bdbc (patch) | |
tree | b78ab8ca9bc57c2c4ee758efc2d8e029bf736c18 /src/testdir | |
parent | 3b2c27415d7d6e97be9580b66528e8c19d19aade (diff) |
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selectionv9.1.0043
Problem: ml_get: invalid lnum when :s replaces visual selection
(@ropery)
Solution: substitute may decrement the number of lines in a buffer,
so validate, that the bottom lines of the visual selection
stays within the max buffer line
fixes: #13890
closes: #13892
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_visual.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim index 401a3504ae..f0d8edcf84 100644 --- a/src/testdir/test_visual.vim +++ b/src/testdir/test_visual.vim @@ -1622,4 +1622,12 @@ func Test_visual_drag_out_of_window() bwipe! endfunc +func Test_visual_substitute_visual() + new + call setline(1, ['one', 'two', 'three']) + call feedkeys("Gk\<C-V>j$:s/\\%V\\_.*\\%V/foobar\<CR>", 'tx') + call assert_equal(['one', 'foobar'], getline(1, '$')) + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |