diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-07 05:37:30 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-07 07:00:11 +0800 |
commit | 0612101c92f7043e47a1b4e80120582ff538c4f8 (patch) | |
tree | 694f97141c0073c4f6017da8737f32672f7e81ea /src/nvim/testdir | |
parent | df4c634d067cf01adca75abb5f38989777c5cddd (diff) | |
download | rneovim-0612101c92f7043e47a1b4e80120582ff538c4f8.tar.gz rneovim-0612101c92f7043e47a1b4e80120582ff538c4f8.tar.bz2 rneovim-0612101c92f7043e47a1b4e80120582ff538c4f8.zip |
vim-patch:8.2.5043: can open a cmdline window from a substitute expression
Problem: Can open a cmdline window from a substitute expression.
Solution: Disallow opening a command line window when text or buffer is
locked.
https://github.com/vim/vim/commit/71223e2db87c2bf3b09aecb46266b56cda26191d
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_substitute.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index e06da3b44f..bc1b3fae4b 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", @@ -873,6 +875,31 @@ func 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] + 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') + let messages = readfile('Xresult') + call assert_match('E565: Not allowed to change text or change window', messages[3]) + endif + + call delete('Xscript') + call delete('Xresult') +endfunc + " Test for the 2-letter and 3-letter :substitute commands func Test_substitute_short_cmd() new |