diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-01 06:12:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 06:12:11 +0800 |
commit | b08667d4f00e434eac9874e4005ab8e1fd9d3e95 (patch) | |
tree | bf4b40e983294fbf96bdd6b9699cdb6526dd0fe6 /src/nvim/buffer.c | |
parent | e005b8d2eb0d5967d46cae604e3fac0ccae37555 (diff) | |
download | rneovim-b08667d4f00e434eac9874e4005ab8e1fd9d3e95.tar.gz rneovim-b08667d4f00e434eac9874e4005ab8e1fd9d3e95.tar.bz2 rneovim-b08667d4f00e434eac9874e4005ab8e1fd9d3e95.zip |
vim-patch:9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf (#28136)
Problem: Filetype may be undetected when a SwapExists autocommand sets
filetype in another buffer.
Solution: Make filetype detection state buffer-specific. Also fix a
similar problem for 'modified' (zeertzjq).
closes: vim/vim#14344
https://github.com/vim/vim/commit/5bf6c2117fcef85fcf046c098dd3eb72a0147859
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 3c2d52e6ad..39d0d24d47 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -267,7 +267,7 @@ int open_buffer(bool read_stdin, exarg_T *eap, int flags_arg) // The autocommands in readfile() may change the buffer, but only AFTER // reading the file. set_bufref(&old_curbuf, curbuf); - modified_was_set = false; + curbuf->b_modified_was_set = false; // mark cursor position as being invalid curwin->w_valid = 0; @@ -350,7 +350,7 @@ int open_buffer(bool read_stdin, exarg_T *eap, int flags_arg) // the changed flag. Unless in readonly mode: "ls | nvim -R -". // When interrupted and 'cpoptions' contains 'i' set changed flag. if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) - || modified_was_set // ":set modified" used in autocmd + || curbuf->b_modified_was_set // autocmd did ":set modified" || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)) { changed(curbuf); } else if (retval != FAIL && !read_stdin && !read_fifo) { @@ -1725,7 +1725,7 @@ void enter_buffer(buf_T *buf) // ":ball" used in an autocommand. If there already is a filetype we // might prefer to keep it. if (*curbuf->b_p_ft == NUL) { - did_filetype = false; + curbuf->b_did_filetype = false; } open_buffer(false, NULL, 0); |