diff src/ex_docmd.c @ 34705:159d598e6781 v9.1.0231

patch 9.1.0231: Filetype may be undetected when SwapExists sets ft in other buf Commit: https://github.com/vim/vim/commit/5bf6c2117fcef85fcf046c098dd3eb72a0147859 Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Mar 31 18:41:27 2024 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Sun, 31 Mar 2024 18:45:05 +0200
parents 6b2efa2b2386
children cda1a8a06777
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -9898,7 +9898,7 @@ ex_filetype(exarg_T *eap)
     static void
 ex_setfiletype(exarg_T *eap)
 {
-    if (did_filetype)
+    if (curbuf->b_did_filetype)
 	return;
 
     char_u *arg = eap->arg;
@@ -9907,7 +9907,7 @@ ex_setfiletype(exarg_T *eap)
 
     set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL);
     if (arg != eap->arg)
-	did_filetype = FALSE;
+	curbuf->b_did_filetype = FALSE;
 }
 
     static void