Mercurial > vim
comparison src/testdir/test_visual.vim @ 34174:8b5471360746 v9.1.0043
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
Commit: https://github.com/vim/vim/commit/7c71db3a58f658b4329b82ab603efa928d17bdbc
Author: Christian Brabandt <cb@256bit.org>
Date: Mon Jan 22 20:12:34 2024 +0100
patch 9.1.0043: ml_get: invalid lnum when :s replaces visual selection
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>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 22 Jan 2024 20:30:05 +0100 |
parents | 63341afcd329 |
children | d2ad8733db75 |
comparison
equal
deleted
inserted
replaced
34173:6cf1bb481903 | 34174:8b5471360746 |
---|---|
1620 delfunc DragExpr | 1620 delfunc DragExpr |
1621 set mouse& | 1621 set mouse& |
1622 bwipe! | 1622 bwipe! |
1623 endfunc | 1623 endfunc |
1624 | 1624 |
1625 func Test_visual_substitute_visual() | |
1626 new | |
1627 call setline(1, ['one', 'two', 'three']) | |
1628 call feedkeys("Gk\<C-V>j$:s/\\%V\\_.*\\%V/foobar\<CR>", 'tx') | |
1629 call assert_equal(['one', 'foobar'], getline(1, '$')) | |
1630 bwipe! | |
1631 endfunc | |
1632 | |
1625 " vim: shiftwidth=2 sts=2 expandtab | 1633 " vim: shiftwidth=2 sts=2 expandtab |