Patch 8.1.0067
Problem: Syntax highlighting not working when re-entering a buffer.
Solution: Do force executing autocommands when not called recursively.
Files: src/option.c
*** ../vim-8.1.0066/src/option.c 2018-06-17 17:32:55.088218019 +0200
--- src/option.c 2018-06-17 19:01:55.382567829 +0200
***************
*** 7567,7590 ****
/* When 'syntax' is set, load the syntax of that name */
if (varp == &(curbuf->b_p_syn))
{
! // Only pass TRUE for "force" when the value changed, to avoid
! // endless recurrence. */
! apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
! curbuf->b_fname, value_changed, curbuf);
}
#endif
else if (varp == &(curbuf->b_p_ft))
{
/* 'filetype' is set, trigger the FileType autocommand.
* Skip this when called from a modeline and the filetype was
! * already set to this value.
! * Only pass TRUE for "force" when the value changed, to avoid
! * endless recurrence. */
if (!(opt_flags & OPT_MODELINE) || value_changed)
{
did_filetype = TRUE;
! apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft,
! curbuf->b_fname, value_changed, curbuf);
/* Just in case the old "curbuf" is now invalid. */
if (varp != &(curbuf->b_p_ft))
varp = NULL;
--- 7567,7598 ----
/* When 'syntax' is set, load the syntax of that name */
if (varp == &(curbuf->b_p_syn))
{
! static int syn_recursive = 0;
!
! ++syn_recursive;
! // Only pass TRUE for "force" when the value changed or not used
! // recursively, to avoid endless recurrence.
! apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname,
! value_changed || syn_recursive == 1, curbuf);
! --syn_recursive;
}
#endif
else if (varp == &(curbuf->b_p_ft))
{
/* 'filetype' is set, trigger the FileType autocommand.
* Skip this when called from a modeline and the filetype was
! * already set to this value. */
if (!(opt_flags & OPT_MODELINE) || value_changed)
{
+ static int ft_recursive = 0;
+
+ ++ft_recursive;
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,
! value_changed || ft_recursive == 1, curbuf);
! --ft_recursive;
/* Just in case the old "curbuf" is now invalid. */
if (varp != &(curbuf->b_p_ft))
varp = NULL;
*** ../vim-8.1.0066/src/version.c 2018-06-17 17:32:55.088218019 +0200
--- src/version.c 2018-06-17 19:07:00.000819142 +0200
***************
*** 763,764 ****
--- 763,766 ----
{ /* Add new patch number below this line */
+ /**/
+ 67,
/**/
--
hundred-and-one symptoms of being an internet addict:
62. If your doorbell rings, you think that new mail has arrived. And then
you're disappointed that it's only someone at the door.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.