From 0cf5cd1ac9c8ec31c1d2f1b1a6585153a45fc4e9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 15 Jul 2022 17:39:06 +0800 Subject: vim-patch:8.2.0403: when 'buftype' is "nofile" there is no overwrite check Problem: When 'buftype' is "nofile" there is no overwrite check. Solution: Also check for existing file when 'buftype' is set. (closes vim/vim#5807) https://github.com/vim/vim/commit/a3a9c8ef697bbf6f640cde99710b6f534f29f77d Nvim doesn't have buftype=popup and doesn't allow buftype=terminal for non-terminal buffer. --- src/nvim/testdir/test_options.vim | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 9f89d47758..3de84d2ae9 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -741,7 +741,16 @@ func Test_buftype() call setline(1, ['L1']) set buftype=nowrite call assert_fails('write', 'E382:') - close! + + " for val in ['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 'terminal', 'prompt', 'popup'] + for val in ['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 'prompt'] + exe 'set buftype=' .. val + call writefile(['something'], 'XBuftype') + call assert_fails('write XBuftype', 'E13:', 'with buftype=' .. val) + endfor + + call delete('XBuftype') + bwipe! endfunc " Test for the 'shellquote' option -- cgit