comparison src/fileio.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 6c7eddcce52c
children adc2dec6d27d
comparison
equal deleted inserted replaced
29866:607385b95bf7 29867:6eaef7375f17
106 * READ_NEW starting to edit a new buffer 106 * READ_NEW starting to edit a new buffer
107 * READ_FILTER reading filter output 107 * READ_FILTER reading filter output
108 * READ_STDIN read from stdin instead of a file 108 * READ_STDIN read from stdin instead of a file
109 * READ_BUFFER read from curbuf instead of a file (converting after reading 109 * READ_BUFFER read from curbuf instead of a file (converting after reading
110 * stdin) 110 * stdin)
111 * READ_NOFILE do not read a file, only trigger BufReadCmd
111 * READ_DUMMY read into a dummy buffer (to check if file contents changed) 112 * READ_DUMMY read into a dummy buffer (to check if file contents changed)
112 * READ_KEEP_UNDO don't clear undo info or read it from a file 113 * READ_KEEP_UNDO don't clear undo info or read it from a file
113 * READ_FIFO read from fifo/socket instead of a file 114 * READ_FIFO read from fifo/socket instead of a file
114 * 115 *
115 * return FAIL for failure, NOTDONE for directory (failure), or OK 116 * return FAIL for failure, NOTDONE for directory (failure), or OK
307 #else 308 #else
308 return OK; 309 return OK;
309 #endif 310 #endif
310 311
311 curbuf->b_op_start = orig_start; 312 curbuf->b_op_start = orig_start;
313
314 if (flags & READ_NOFILE)
315 return FAIL;
312 } 316 }
313 317
314 if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0) 318 if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
315 msg_scroll = FALSE; // overwrite previous file message 319 msg_scroll = FALSE; // overwrite previous file message
316 else 320 else