mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.0275: BufEnter not triggered when using ":edit" in "nofile" buffer
Problem: BufEnter not triggered when using ":edit" in "nofile" buffer. Solution: Let readfile() return NOTDONE. (closes #10986)
This commit is contained in:
@@ -312,7 +312,7 @@ readfile(
|
|||||||
curbuf->b_op_start = orig_start;
|
curbuf->b_op_start = orig_start;
|
||||||
|
|
||||||
if (flags & READ_NOFILE)
|
if (flags & READ_NOFILE)
|
||||||
return FAIL;
|
return NOTDONE; // so that BufEnter can be triggered
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
|
if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
|
||||||
|
@@ -681,9 +681,19 @@ func Test_BufEnter()
|
|||||||
" On MS-Windows we can't edit the directory, make sure we wipe the right
|
" On MS-Windows we can't edit the directory, make sure we wipe the right
|
||||||
" buffer.
|
" buffer.
|
||||||
bwipe! Xdir
|
bwipe! Xdir
|
||||||
|
|
||||||
call delete('Xdir', 'd')
|
call delete('Xdir', 'd')
|
||||||
au! BufEnter
|
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
|
endfunc
|
||||||
|
|
||||||
" Closing a window might cause an endless loop
|
" Closing a window might cause an endless loop
|
||||||
|
@@ -723,6 +723,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
275,
|
||||||
/**/
|
/**/
|
||||||
274,
|
274,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user