To: vim_dev@googlegroups.com Subject: Patch 8.2.0403 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0403 Problem: When 'buftype' is "nofile" there is no overwrite check. Solution: Also check for existing file when 'buftype' is set. (closes #5807) Files: src/ex_cmds.c, src/testdir/test_options.vim *** ../vim-8.2.0402/src/ex_cmds.c 2020-02-17 22:39:32.068004581 +0100 --- src/ex_cmds.c 2020-03-19 12:21:23.901743302 +0100 *************** *** 2074,2081 **** int other) // writing under other name { /* ! * write to other file or b_flags set or not writing the whole file: ! * overwriting only allowed with '!' */ if ( (other || (buf->b_flags & BF_NOTEDITED) --- 2074,2081 ---- int other) // writing under other name { /* ! * Write to another file or b_flags set or not writing the whole file: ! * overwriting only allowed with '!'. */ if ( (other || (buf->b_flags & BF_NOTEDITED) *************** *** 2083,2091 **** && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) || (buf->b_flags & BF_READERR)) && !p_wa - #ifdef FEAT_QUICKFIX - && !bt_nofilename(buf) - #endif && vim_fexists(ffname)) { if (!eap->forceit && !eap->append) --- 2083,2088 ---- *** ../vim-8.2.0402/src/testdir/test_options.vim 2020-02-27 21:32:38.681185130 +0100 --- src/testdir/test_options.vim 2020-03-19 12:20:10.466021045 +0100 *************** *** 656,662 **** call setline(1, ['L1']) set buftype=nowrite call assert_fails('write', 'E382:') ! close! endfunc " Test for the 'shellquote' option --- 656,670 ---- call setline(1, ['L1']) set buftype=nowrite call assert_fails('write', 'E382:') ! ! for val in ['', 'nofile', 'nowrite', 'acwrite', 'quickfix', 'help', 'terminal', 'prompt', 'popup'] ! 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 *** ../vim-8.2.0402/src/version.c 2020-03-18 21:10:41.104567492 +0100 --- src/version.c 2020-03-19 12:07:12.932915355 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 403, /**/ -- Linux is just like a wigwam: no Windows, no Gates and an Apache inside. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///