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 -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220826121721.49DAB1C090E%40moolenaar.net.