summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0638
blob: a88d7b2cb6715740d0e7d35307adf6b0b8e35d5f (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0638
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.0638
Problem:    Text property highlighting is off by one column. (Bjorn Linse)
Solution:   Update text property highlighting earlier.  Let it overrule syntax
            highlighting.
Files:	    src/structs.h, src/screen.c


*** ../vim-8.1.0637/src/structs.h	2018-12-25 23:15:41.795966567 +0100
--- src/structs.h	2018-12-25 23:48:14.284675586 +0100
***************
*** 705,711 ****
   */
  typedef struct textprop_S
  {
!     colnr_T	tp_col;		// start column
      colnr_T	tp_len;		// length in bytes
      int		tp_id;		// identifier
      int		tp_type;	// property type
--- 705,711 ----
   */
  typedef struct textprop_S
  {
!     colnr_T	tp_col;		// start column (one based)
      colnr_T	tp_len;		// length in bytes
      int		tp_id;		// identifier
      int		tp_type;	// property type
*** ../vim-8.1.0637/src/screen.c	2018-12-22 17:07:45.771347741 +0100
--- src/screen.c	2018-12-26 00:19:53.558481875 +0100
***************
*** 4294,4299 ****
--- 4294,4359 ----
  	    }
  #endif
  
+ #ifdef FEAT_TEXT_PROP
+ 	    if (text_props != NULL)
+ 	    {
+ 		int pi;
+ 
+ 		// Check if any active property ends.
+ 		for (pi = 0; pi < text_props_active; ++pi)
+ 		{
+ 		    int tpi = text_prop_idxs[pi];
+ 
+ 		    if (col >= text_props[tpi].tp_col - 1
+ 						  + text_props[tpi].tp_len)
+ 		    {
+ 			if (pi + 1 < text_props_active)
+ 			    mch_memmove(text_prop_idxs + pi,
+ 					text_prop_idxs + pi + 1,
+ 					sizeof(int)
+ 					 * (text_props_active - (pi + 1)));
+ 			--text_props_active;
+ 			--pi;
+ 		    }
+ 		}
+ 
+ 		// Add any text property that starts in this column.
+ 		while (text_prop_next < text_prop_count
+ 			   && col >= text_props[text_prop_next].tp_col - 1)
+ 		    text_prop_idxs[text_props_active++] = text_prop_next++;
+ 
+ 		text_prop_type = NULL;
+ 		if (text_props_active > 0)
+ 		{
+ 		    int max_priority = INT_MIN;
+ 		    int max_col = 0;
+ 
+ 		    // Get the property type with the highest priority
+ 		    // and/or starting last.
+ 		    for (pi = 0; pi < text_props_active; ++pi)
+ 		    {
+ 			int		tpi = text_prop_idxs[pi];
+ 			proptype_T  *pt;
+ 
+ 			pt = text_prop_type_by_id(
+ 				curwin->w_buffer, text_props[tpi].tp_type);
+ 			if (pt != NULL
+ 				&& (pt->pt_priority > max_priority
+ 				    || (pt->pt_priority == max_priority
+ 				    && text_props[tpi].tp_col >= max_col)))
+ 			{
+ 			    text_prop_type = pt;
+ 			    max_priority = pt->pt_priority;
+ 			    max_col = text_props[tpi].tp_col;
+ 			}
+ 		    }
+ 		    if (text_prop_type != NULL)
+ 			text_prop_attr =
+ 				     syn_id2attr(text_prop_type->pt_hl_id);
+ 		}
+ 	    }
+ #endif
+ 
  	    /* Decide which of the highlight attributes to use. */
  	    attr_pri = TRUE;
  #ifdef LINE_ATTR
***************
*** 4653,4660 ****
  #endif
  
  #ifdef FEAT_SYN_HL
! 		/* Get syntax attribute, unless still at the start of the line
! 		 * (double-wide char that doesn't fit). */
  		v = (long)(ptr - line);
  		if (has_syntax && v > 0)
  		{
--- 4713,4720 ----
  #endif
  
  #ifdef FEAT_SYN_HL
! 		// Get syntax attribute, unless still at the start of the line
! 		// (double-wide char that doesn't fit).
  		v = (long)(ptr - line);
  		if (has_syntax && v > 0)
  		{
***************
*** 4686,4695 ****
  		    line = ml_get_buf(wp->w_buffer, lnum, FALSE);
  		    ptr = line + v;
  
! 		    if (!attr_pri)
! 			char_attr = syntax_attr;
! 		    else
! 			char_attr = hl_combine_attr(syntax_attr, char_attr);
  # ifdef FEAT_CONCEAL
  		    /* no concealing past the end of the line, it interferes
  		     * with line highlighting */
--- 4746,4761 ----
  		    line = ml_get_buf(wp->w_buffer, lnum, FALSE);
  		    ptr = line + v;
  
! # ifdef FEAT_TEXT_PROP
! 		    // Text properties overrule syntax highlighting.
! 		    if (text_prop_attr == 0)
! #endif
! 		    {
! 			if (!attr_pri)
! 			    char_attr = syntax_attr;
! 			else
! 			    char_attr = hl_combine_attr(syntax_attr, char_attr);
! 		    }
  # ifdef FEAT_CONCEAL
  		    /* no concealing past the end of the line, it interferes
  		     * with line highlighting */
***************
*** 4701,4766 ****
  		}
  #endif
  
- #ifdef FEAT_TEXT_PROP
- 		if (text_props != NULL)
- 		{
- 		    int pi;
- 
- 		    // Check if any active property ends.
- 		    for (pi = 0; pi < text_props_active; ++pi)
- 		    {
- 			int tpi = text_prop_idxs[pi];
- 
- 			if (col >= text_props[tpi].tp_col - 1
- 						      + text_props[tpi].tp_len)
- 			{
- 			    if (pi + 1 < text_props_active)
- 				mch_memmove(text_prop_idxs + pi,
- 					    text_prop_idxs + pi + 1,
- 					    sizeof(int)
- 					     * (text_props_active - (pi + 1)));
- 			    --text_props_active;
- 			    --pi;
- 			}
- 		    }
- 
- 		    // Add any text property that starts in this column.
- 		    while (text_prop_next < text_prop_count
- 			       && col >= text_props[text_prop_next].tp_col - 1)
- 			text_prop_idxs[text_props_active++] = text_prop_next++;
- 
- 		    text_prop_type = NULL;
- 		    if (text_props_active > 0)
- 		    {
- 			int max_priority = INT_MIN;
- 			int max_col = 0;
- 
- 			// Get the property type with the highest priority
- 			// and/or starting last.
- 			for (pi = 0; pi < text_props_active; ++pi)
- 			{
- 			    int		tpi = text_prop_idxs[pi];
- 			    proptype_T  *pt;
- 
- 			    pt = text_prop_type_by_id(
- 				    curwin->w_buffer, text_props[tpi].tp_type);
- 			    if (pt != NULL
- 				    && (pt->pt_priority > max_priority
- 					|| (pt->pt_priority == max_priority
- 					&& text_props[tpi].tp_col >= max_col)))
- 			    {
- 				text_prop_type = pt;
- 				max_priority = pt->pt_priority;
- 				max_col = text_props[tpi].tp_col;
- 			    }
- 			}
- 			if (text_prop_type != NULL)
- 			    text_prop_attr =
- 					 syn_id2attr(text_prop_type->pt_hl_id);
- 		    }
- 		}
- #endif
- 
  #ifdef FEAT_SPELL
  		/* Check spelling (unless at the end of the line).
  		 * Only do this when there is no syntax highlighting, the
--- 4767,4772 ----
*** ../vim-8.1.0637/src/version.c	2018-12-25 23:36:44.942120387 +0100
--- src/version.c	2018-12-26 00:18:03.287330017 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     638,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
46. Your wife makes a new rule: "The computer cannot come to bed."

 /// 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    ///