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>
diff --git a/src/optionstr.c b/src/optionstr.c
index e5f4946..45f126f 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -4332,7 +4332,7 @@
secure = 0;
++ft_recursive;
- did_filetype = TRUE;
+ curbuf->b_did_filetype = TRUE;
// Only pass TRUE for "force" when the value changed or not
// used recursively, to avoid endless recurrence.
apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname,