mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf
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: #14344 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
8603270293
commit
5bf6c2117f
@@ -225,7 +225,7 @@ open_buffer(
|
||||
// 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;
|
||||
@@ -322,7 +322,7 @@ open_buffer(
|
||||
// the changed flag. Unless in readonly mode: "ls | gview -".
|
||||
// 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"
|
||||
#ifdef FEAT_EVAL
|
||||
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
|
||||
#endif
|
||||
@@ -1944,7 +1944,7 @@ 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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user