diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-05-27 05:12:59 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-07 07:00:11 +0800 |
| commit | df4c634d067cf01adca75abb5f38989777c5cddd (patch) | |
| tree | 62f3beb3811b71d7712662a69ed82cbebfecab23 /src/nvim/testdir | |
| parent | 4ffe5d018919d3fbea21e667f09f14b9751f9cd5 (diff) | |
| download | rneovim-df4c634d067cf01adca75abb5f38989777c5cddd.tar.gz rneovim-df4c634d067cf01adca75abb5f38989777c5cddd.tar.bz2 rneovim-df4c634d067cf01adca75abb5f38989777c5cddd.zip | |
vim-patch:8.2.5023: substitute overwrites allocated buffer
Problem: Substitute overwrites allocated buffer.
Solution: Disallow undo when in a substitute command.
https://github.com/vim/vim/commit/338f1fc0ee3ca929387448fe464579d6113fa76a
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/test_substitute.vim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index bd44079882..e06da3b44f 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -851,6 +851,28 @@ func Test_sub_change_window() delfunc Repl endfunc +" This was undoign a change in between computing the length and using it. +func Do_Test_sub_undo_change() + new + norm o0000000000000000000000000000000000000000000000000000 + silent! s/\%')/\=Repl() + bwipe! +endfunc + +func Test_sub_undo_change() + func Repl() + silent! norm g- + endfunc + call Do_Test_sub_undo_change() + + func! Repl() + silent earlier + endfunc + call Do_Test_sub_undo_change() + + delfunc Repl +endfunc + " Test for the 2-letter and 3-letter :substitute commands func Test_substitute_short_cmd() new |