summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0067
blob: 3a183214a9aab9ac7a83c7d5b75f22615652a06c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0067
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

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 -- Bram@Moolenaar.net -- 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    ///