aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-26 19:04:20 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-27 06:12:52 +0800
commit900a151bf541c7fa77a56b4881c4836a1cabcde6 (patch)
tree32973768295e652ac35bdc946a7f76d5cefcc0d0 /src/nvim/fileio.c
parentb0e052a8b30ce84221c3f992e111713451633b36 (diff)
downloadrneovim-900a151bf541c7fa77a56b4881c4836a1cabcde6.tar.gz
rneovim-900a151bf541c7fa77a56b4881c4836a1cabcde6.tar.bz2
rneovim-900a151bf541c7fa77a56b4881c4836a1cabcde6.zip
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) https://github.com/vim/vim/commit/b1d2c8116cb5577961ea109651fb888b5e58265f
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 21c1549f42..fdba186200 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -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) {