comparison src/buffer.c @ 29867:6eaef7375f17 v9.0.0272

patch 9.0.0272: BufReadCmd not triggered when loading a "nofile" buffer Commit: https://github.com/vim/vim/commit/b1d2c8116cb5577961ea109651fb888b5e58265f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 26 11:55:01 2022 +0100 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 #10983)
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Aug 2022 13:00:04 +0200
parents 6bddfc49c35b
children a4eab0d846dc
comparison
equal deleted inserted replaced
29866:607385b95bf7 29867:6eaef7375f17
165 */ 165 */
166 int 166 int
167 open_buffer( 167 open_buffer(
168 int read_stdin, // read file from stdin 168 int read_stdin, // read file from stdin
169 exarg_T *eap, // for forced 'ff' and 'fenc' or NULL 169 exarg_T *eap, // for forced 'ff' and 'fenc' or NULL
170 int flags) // extra flags for readfile() 170 int flags_arg) // extra flags for readfile()
171 { 171 {
172 int flags = flags_arg;
172 int retval = OK; 173 int retval = OK;
173 bufref_T old_curbuf; 174 bufref_T old_curbuf;
174 #ifdef FEAT_SYN_HL 175 #ifdef FEAT_SYN_HL
175 long old_tw = curbuf->b_p_tw; 176 long old_tw = curbuf->b_p_tw;
176 #endif 177 #endif
218 modified_was_set = FALSE; 219 modified_was_set = FALSE;
219 220
220 // mark cursor position as being invalid 221 // mark cursor position as being invalid
221 curwin->w_valid = 0; 222 curwin->w_valid = 0;
222 223
224 // A buffer without an actual file should not use the buffer name to read a
225 // file.
226 if (bt_quickfix(curbuf) || bt_nofilename(curbuf))
227 flags |= READ_NOFILE;
228
223 // Read the file if there is one. 229 // Read the file if there is one.
224 if (curbuf->b_ffname != NULL 230 if (curbuf->b_ffname != NULL
225 && !bt_quickfix(curbuf)
226 && !bt_nofilename(curbuf)
227 #ifdef FEAT_NETBEANS_INTG 231 #ifdef FEAT_NETBEANS_INTG
228 && netbeansReadFile 232 && netbeansReadFile
229 #endif 233 #endif
230 ) 234 )
231 { 235 {