diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-07 07:21:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 07:21:50 +0800 |
commit | 5e84db5c90db60f68fe69b3585ba742d1a872b90 (patch) | |
tree | ce06952a02c3768eba6180dc24d77421176d62ff /src/nvim/testdir | |
parent | 4ffe5d018919d3fbea21e667f09f14b9751f9cd5 (diff) | |
parent | d4db87f4932a3a994cd5364c1cf85f0913a37070 (diff) | |
download | rneovim-5e84db5c90db60f68fe69b3585ba742d1a872b90.tar.gz rneovim-5e84db5c90db60f68fe69b3585ba742d1a872b90.tar.bz2 rneovim-5e84db5c90db60f68fe69b3585ba742d1a872b90.zip |
Merge pull request #19261 from zeertzjq/vim-8.2.5023
vim-patch:8.2.{5023,5043,5044}: substitute textlock fixes
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_substitute.vim | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index bd44079882..619b63202a 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -1,5 +1,7 @@ " Tests for the substitute (:s) command +source shared.vim + func Test_multiline_subst() enew! call append(0, ["1 aa", @@ -851,6 +853,54 @@ 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 + +" This was opening a command line window from the expression +func Test_sub_open_cmdline_win() + " the error only happens in a very specific setup, run a new Vim instance to + " get a clean starting point. + let lines =<< trim [SCRIPT] + set vb t_vb= + norm o0000000000000000000000000000000000000000000000000000 + func Replace() + norm q/ + endfunc + s/\%')/\=Replace() + redir >Xresult + messages + redir END + qall! + [SCRIPT] + call writefile(lines, 'Xscript') + if RunVim([], [], '-u NONE -S Xscript') + call assert_match('E565: Not allowed to change text or change window', + \ readfile('Xresult')->join('XX')) + endif + + call delete('Xscript') + call delete('Xresult') +endfunc + " Test for the 2-letter and 3-letter :substitute commands func Test_substitute_short_cmd() new |