To: vim_dev@googlegroups.com Subject: Patch 9.0.0275 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0275 Problem: BufEnter not triggered when using ":edit" in "nofile" buffer. Solution: Let readfile() return NOTDONE. (closes #10986) Files: src/fileio.c, src/testdir/test_autocmd.vim *** ../vim-9.0.0274/src/fileio.c 2022-08-26 11:54:58.385177821 +0100 --- src/fileio.c 2022-08-26 13:10:42.425700271 +0100 *************** *** 312,318 **** curbuf->b_op_start = orig_start; if (flags & READ_NOFILE) ! return FAIL; } if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) --- 312,318 ---- curbuf->b_op_start = orig_start; if (flags & READ_NOFILE) ! return NOTDONE; // so that BufEnter can be triggered } if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) *** ../vim-9.0.0274/src/testdir/test_autocmd.vim 2022-08-26 11:54:58.385177821 +0100 --- src/testdir/test_autocmd.vim 2022-08-26 13:15:12.049244440 +0100 *************** *** 681,689 **** " On MS-Windows we can't edit the directory, make sure we wipe the right " buffer. bwipe! Xdir - call delete('Xdir', 'd') au! BufEnter endfunc " Closing a window might cause an endless loop --- 681,699 ---- " On MS-Windows we can't edit the directory, make sure we wipe the right " buffer. bwipe! Xdir call delete('Xdir', 'd') au! BufEnter + + " Editing a "nofile" buffer doesn't read the file but does trigger BufEnter + " for historic reasons. + new somefile + set buftype=nofile + au BufEnter somefile call setline(1, 'some text') + edit + call assert_equal('some text', getline(1)) + + bwipe! + au! BufEnter endfunc " Closing a window might cause an endless loop *** ../vim-9.0.0274/src/version.c 2022-08-26 12:58:14.517930190 +0100 --- src/version.c 2022-08-26 13:11:45.673602897 +0100 *************** *** 725,726 **** --- 725,728 ---- { /* Add new patch number below this line */ + /**/ + 275, /**/ -- bashian roulette: $ ((RANDOM%6)) || rm -rf ~ /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///