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

5bf6c2117f
This commit is contained in:
zeertzjq
2024-04-01 06:12:11 +08:00
committed by GitHub
parent e005b8d2eb
commit b08667d4f0
12 changed files with 109 additions and 32 deletions

View File

@@ -7382,7 +7382,7 @@ void filetype_maybe_enable(void)
/// ":setfiletype [FALLBACK] {name}"
static void ex_setfiletype(exarg_T *eap)
{
if (did_filetype) {
if (curbuf->b_did_filetype) {
return;
}
@@ -7393,7 +7393,7 @@ static void ex_setfiletype(exarg_T *eap)
set_option_value_give_err(kOptFiletype, CSTR_AS_OPTVAL(arg), OPT_LOCAL);
if (arg != eap->arg) {
did_filetype = false;
curbuf->b_did_filetype = false;
}
}