vim-patch:9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer

Problem:    BufReadCmd not triggered when loading a "nofile" buffer. (Maxim
            Kim)
Solution:   Call readfile() but bail out before reading a file.
            (closes vim/vim#10983)
b1d2c8116c
This commit is contained in:
zeertzjq
2022-08-26 19:04:20 +08:00
parent b0e052a8b3
commit 900a151bf5
4 changed files with 28 additions and 3 deletions

View File

@@ -167,6 +167,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr)
/// READ_STDIN read from stdin instead of a file
/// READ_BUFFER read from curbuf instead of a file (converting after reading
/// stdin)
/// READ_NOFILE do not read a file, only trigger BufReadCmd
/// READ_DUMMY read into a dummy buffer (to check if file contents changed)
/// READ_KEEP_UNDO don't clear undo info or read it from a file
/// READ_FIFO read from fifo/socket instead of a file
@@ -334,6 +335,10 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
}
curbuf->b_op_start = orig_start;
if (flags & READ_NOFILE) {
return FAIL;
}
}
if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) {