diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-26 11:55:01 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-26 11:55:01 +0100 |
commit | b1d2c8116cb5577961ea109651fb888b5e58265f (patch) | |
tree | 3cca94a88929fc31a58d1965da471e7b1e8050a2 /src/buffer.c | |
parent | 9b7d2a959646560f5770329f4428c4739eed4656 (diff) |
patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" bufferv9.0.0272
Problem: BufReadCmd not triggered when loading a "nofile" buffer. (Maxim
Kim)
Solution: Call readfile() but bail out before reading a file.
(closes #10983)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c index 7286852812..2c8169478c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -167,8 +167,9 @@ buffer_ensure_loaded(buf_T *buf) open_buffer( int read_stdin, // read file from stdin exarg_T *eap, // for forced 'ff' and 'fenc' or NULL - int flags) // extra flags for readfile() + int flags_arg) // extra flags for readfile() { + int flags = flags_arg; int retval = OK; bufref_T old_curbuf; #ifdef FEAT_SYN_HL @@ -220,10 +221,13 @@ open_buffer( // mark cursor position as being invalid curwin->w_valid = 0; + // A buffer without an actual file should not use the buffer name to read a + // file. + if (bt_quickfix(curbuf) || bt_nofilename(curbuf)) + flags |= READ_NOFILE; + // Read the file if there is one. if (curbuf->b_ffname != NULL - && !bt_quickfix(curbuf) - && !bt_nofilename(curbuf) #ifdef FEAT_NETBEANS_INTG && netbeansReadFile #endif |