]>
Commit | Line | Data |
---|---|---|
d57b4abe ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.219 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.219 (after 7.1.215) | |
11 | Problem: synstack() returns situation after the current character, can't | |
12 | see the state for a one-character region. | |
13 | Solution: Don't update ending states in the requested column. | |
14 | Files: runtime/doc/eval.txt, src/eval.c, src/hardcopy.c, | |
15 | src/proto/syntax.pro, src/screen.c, src/spell.c, src/syntax.c | |
16 | ||
17 | ||
18 | *** ../vim-7.1.218/runtime/doc/eval.txt Thu Jan 10 22:23:22 2008 | |
19 | --- runtime/doc/eval.txt Fri Jan 11 22:04:59 2008 | |
20 | *************** | |
21 | *** 1,4 **** | |
22 | ! *eval.txt* For Vim version 7.1. Last change: 2008 Jan 10 | |
23 | ||
24 | ||
25 | VIM REFERENCE MANUAL by Bram Moolenaar | |
26 | --- 1,4 ---- | |
27 | ! *eval.txt* For Vim version 7.1. Last change: 2008 Jan 11 | |
28 | ||
29 | ||
30 | VIM REFERENCE MANUAL by Bram Moolenaar | |
31 | *************** | |
32 | *** 4967,4976 **** | |
33 | Return a |List|, which is the stack of syntax items at the | |
34 | position {lnum} and {col} in the current window. Each item in | |
35 | the List is an ID like what |synID()| returns. | |
36 | - The stack is the situation in between the character at "col" | |
37 | - and the next character. Note that a region of only one | |
38 | - character will not show up, it only exists inside that | |
39 | - character, not in between characters. | |
40 | The first item in the List is the outer region, following are | |
41 | items contained in that one. The last one is what |synID()| | |
42 | returns, unless not the whole item is highlighted or it is a | |
43 | --- 4970,4975 ---- | |
44 | *** ../vim-7.1.218/src/eval.c Thu Jan 10 22:23:22 2008 | |
45 | --- src/eval.c Fri Jan 11 21:46:12 2008 | |
46 | *************** | |
47 | *** 15725,15731 **** | |
48 | ||
49 | if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count | |
50 | && col >= 0 && col < (long)STRLEN(ml_get(lnum))) | |
51 | ! id = syn_get_id(curwin, lnum, (colnr_T)col, trans, NULL); | |
52 | #endif | |
53 | ||
54 | rettv->vval.v_number = id; | |
55 | --- 15725,15731 ---- | |
56 | ||
57 | if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count | |
58 | && col >= 0 && col < (long)STRLEN(ml_get(lnum))) | |
59 | ! id = syn_get_id(curwin, lnum, (colnr_T)col, trans, NULL, FALSE); | |
60 | #endif | |
61 | ||
62 | rettv->vval.v_number = id; | |
63 | *************** | |
64 | *** 15874,15880 **** | |
65 | && col >= 0 && col < (long)STRLEN(ml_get(lnum)) | |
66 | && rettv_list_alloc(rettv) != FAIL) | |
67 | { | |
68 | ! (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL); | |
69 | for (i = 0; ; ++i) | |
70 | { | |
71 | id = syn_get_stack_item(i); | |
72 | --- 15874,15880 ---- | |
73 | && col >= 0 && col < (long)STRLEN(ml_get(lnum)) | |
74 | && rettv_list_alloc(rettv) != FAIL) | |
75 | { | |
76 | ! (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); | |
77 | for (i = 0; ; ++i) | |
78 | { | |
79 | id = syn_get_stack_item(i); | |
80 | *** ../vim-7.1.218/src/hardcopy.c Thu May 10 20:40:02 2007 | |
81 | --- src/hardcopy.c Fri Jan 11 21:46:20 2008 | |
82 | *************** | |
83 | *** 876,882 **** | |
84 | */ | |
85 | if (psettings->do_syntax) | |
86 | { | |
87 | ! id = syn_get_id(curwin, ppos->file_line, col, 1, NULL); | |
88 | if (id > 0) | |
89 | id = syn_get_final_id(id); | |
90 | else | |
91 | --- 876,882 ---- | |
92 | */ | |
93 | if (psettings->do_syntax) | |
94 | { | |
95 | ! id = syn_get_id(curwin, ppos->file_line, col, 1, NULL, FALSE); | |
96 | if (id > 0) | |
97 | id = syn_get_final_id(id); | |
98 | else | |
99 | *** ../vim-7.1.218/src/proto/syntax.pro Thu Jan 10 22:23:22 2008 | |
100 | --- src/proto/syntax.pro Fri Jan 11 21:54:19 2008 | |
101 | *************** | |
102 | *** 4,10 **** | |
103 | void syn_stack_apply_changes __ARGS((buf_T *buf)); | |
104 | void syntax_end_parsing __ARGS((linenr_T lnum)); | |
105 | int syntax_check_changed __ARGS((linenr_T lnum)); | |
106 | ! int get_syntax_attr __ARGS((colnr_T col, int *can_spell)); | |
107 | void syntax_clear __ARGS((buf_T *buf)); | |
108 | void ex_syntax __ARGS((exarg_T *eap)); | |
109 | int syntax_present __ARGS((buf_T *buf)); | |
110 | --- 4,10 ---- | |
111 | void syn_stack_apply_changes __ARGS((buf_T *buf)); | |
112 | void syntax_end_parsing __ARGS((linenr_T lnum)); | |
113 | int syntax_check_changed __ARGS((linenr_T lnum)); | |
114 | ! int get_syntax_attr __ARGS((colnr_T col, int *can_spell, int keep_state)); | |
115 | void syntax_clear __ARGS((buf_T *buf)); | |
116 | void ex_syntax __ARGS((exarg_T *eap)); | |
117 | int syntax_present __ARGS((buf_T *buf)); | |
118 | *************** | |
119 | *** 12,18 **** | |
120 | void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg)); | |
121 | void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg)); | |
122 | char_u *get_syntax_name __ARGS((expand_T *xp, int idx)); | |
123 | ! int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp)); | |
124 | int syn_get_stack_item __ARGS((int i)); | |
125 | int syn_get_foldlevel __ARGS((win_T *wp, long lnum)); | |
126 | void init_highlight __ARGS((int both, int reset)); | |
127 | --- 12,18 ---- | |
128 | void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg)); | |
129 | void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg)); | |
130 | char_u *get_syntax_name __ARGS((expand_T *xp, int idx)); | |
131 | ! int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp, int keep_state)); | |
132 | int syn_get_stack_item __ARGS((int i)); | |
133 | int syn_get_foldlevel __ARGS((win_T *wp, long lnum)); | |
134 | void init_highlight __ARGS((int both, int reset)); | |
135 | *** ../vim-7.1.218/src/screen.c Thu Nov 8 21:23:34 2007 | |
136 | --- src/screen.c Fri Jan 11 21:48:10 2008 | |
137 | *************** | |
138 | *** 3885,3891 **** | |
139 | # ifdef FEAT_SPELL | |
140 | has_spell ? &can_spell : | |
141 | # endif | |
142 | ! NULL); | |
143 | ||
144 | if (did_emsg) | |
145 | { | |
146 | --- 3885,3891 ---- | |
147 | # ifdef FEAT_SPELL | |
148 | has_spell ? &can_spell : | |
149 | # endif | |
150 | ! NULL, FALSE); | |
151 | ||
152 | if (did_emsg) | |
153 | { | |
154 | *** ../vim-7.1.218/src/spell.c Sun Aug 5 18:32:21 2007 | |
155 | --- src/spell.c Fri Jan 11 21:46:50 2008 | |
156 | *************** | |
157 | *** 2146,2152 **** | |
158 | { | |
159 | col = (int)(p - buf); | |
160 | (void)syn_get_id(wp, lnum, (colnr_T)col, | |
161 | ! FALSE, &can_spell); | |
162 | if (!can_spell) | |
163 | attr = HLF_COUNT; | |
164 | } | |
165 | --- 2146,2152 ---- | |
166 | { | |
167 | col = (int)(p - buf); | |
168 | (void)syn_get_id(wp, lnum, (colnr_T)col, | |
169 | ! FALSE, &can_spell, FALSE); | |
170 | if (!can_spell) | |
171 | attr = HLF_COUNT; | |
172 | } | |
173 | *** ../vim-7.1.218/src/syntax.c Fri Jan 11 21:26:49 2008 | |
174 | --- src/syntax.c Sat Jan 12 16:42:25 2008 | |
175 | *************** | |
176 | *** 378,384 **** | |
177 | static int syn_stack_equal __ARGS((synstate_T *sp)); | |
178 | static void validate_current_state __ARGS((void)); | |
179 | static int syn_finish_line __ARGS((int syncing)); | |
180 | ! static int syn_current_attr __ARGS((int syncing, int displaying, int *can_spell)); | |
181 | static int did_match_already __ARGS((int idx, garray_T *gap)); | |
182 | static stateitem_T *push_next_match __ARGS((stateitem_T *cur_si)); | |
183 | static void check_state_ends __ARGS((void)); | |
184 | --- 378,384 ---- | |
185 | static int syn_stack_equal __ARGS((synstate_T *sp)); | |
186 | static void validate_current_state __ARGS((void)); | |
187 | static int syn_finish_line __ARGS((int syncing)); | |
188 | ! static int syn_current_attr __ARGS((int syncing, int displaying, int *can_spell, int keep_state)); | |
189 | static int did_match_already __ARGS((int idx, garray_T *gap)); | |
190 | static stateitem_T *push_next_match __ARGS((stateitem_T *cur_si)); | |
191 | static void check_state_ends __ARGS((void)); | |
192 | *************** | |
193 | *** 1691,1697 **** | |
194 | { | |
195 | while (!current_finished) | |
196 | { | |
197 | ! (void)syn_current_attr(syncing, FALSE, NULL); | |
198 | /* | |
199 | * When syncing, and found some item, need to check the item. | |
200 | */ | |
201 | --- 1690,1696 ---- | |
202 | { | |
203 | while (!current_finished) | |
204 | { | |
205 | ! (void)syn_current_attr(syncing, FALSE, NULL, FALSE); | |
206 | /* | |
207 | * When syncing, and found some item, need to check the item. | |
208 | */ | |
209 | *************** | |
210 | *** 1731,1739 **** | |
211 | * done. | |
212 | */ | |
213 | int | |
214 | ! get_syntax_attr(col, can_spell) | |
215 | colnr_T col; | |
216 | int *can_spell; | |
217 | { | |
218 | int attr = 0; | |
219 | ||
220 | --- 1730,1739 ---- | |
221 | * done. | |
222 | */ | |
223 | int | |
224 | ! get_syntax_attr(col, can_spell, keep_state) | |
225 | colnr_T col; | |
226 | int *can_spell; | |
227 | + int keep_state; /* keep state of char at "col" */ | |
228 | { | |
229 | int attr = 0; | |
230 | ||
231 | *************** | |
232 | *** 1768,1774 **** | |
233 | */ | |
234 | while (current_col <= col) | |
235 | { | |
236 | ! attr = syn_current_attr(FALSE, TRUE, can_spell); | |
237 | ++current_col; | |
238 | } | |
239 | ||
240 | --- 1768,1775 ---- | |
241 | */ | |
242 | while (current_col <= col) | |
243 | { | |
244 | ! attr = syn_current_attr(FALSE, TRUE, can_spell, | |
245 | ! current_col == col ? keep_state : FALSE); | |
246 | ++current_col; | |
247 | } | |
248 | ||
249 | *************** | |
250 | *** 1779,1788 **** | |
251 | * Get syntax attributes for current_lnum, current_col. | |
252 | */ | |
253 | static int | |
254 | ! syn_current_attr(syncing, displaying, can_spell) | |
255 | int syncing; /* When 1: called for syncing */ | |
256 | int displaying; /* result will be displayed */ | |
257 | int *can_spell; /* return: do spell checking */ | |
258 | { | |
259 | int syn_id; | |
260 | lpos_T endpos; /* was: char_u *endp; */ | |
261 | --- 1780,1790 ---- | |
262 | * Get syntax attributes for current_lnum, current_col. | |
263 | */ | |
264 | static int | |
265 | ! syn_current_attr(syncing, displaying, can_spell, keep_state) | |
266 | int syncing; /* When 1: called for syncing */ | |
267 | int displaying; /* result will be displayed */ | |
268 | int *can_spell; /* return: do spell checking */ | |
269 | + int keep_state; /* keep syntax stack afterwards */ | |
270 | { | |
271 | int syn_id; | |
272 | lpos_T endpos; /* was: char_u *endp; */ | |
273 | *************** | |
274 | *** 2298,2304 **** | |
275 | * may be for an empty match and a containing item might end in the | |
276 | * current column. | |
277 | */ | |
278 | ! if (!syncing) | |
279 | { | |
280 | check_state_ends(); | |
281 | if (current_state.ga_len > 0 | |
282 | --- 2300,2306 ---- | |
283 | * may be for an empty match and a containing item might end in the | |
284 | * current column. | |
285 | */ | |
286 | ! if (!syncing && !keep_state) | |
287 | { | |
288 | check_state_ends(); | |
289 | if (current_state.ga_len > 0 | |
290 | *************** | |
291 | *** 6086,6097 **** | |
292 | * Function called for expression evaluation: get syntax ID at file position. | |
293 | */ | |
294 | int | |
295 | ! syn_get_id(wp, lnum, col, trans, spellp) | |
296 | win_T *wp; | |
297 | long lnum; | |
298 | colnr_T col; | |
299 | ! int trans; /* remove transparancy */ | |
300 | ! int *spellp; /* return: can do spell checking */ | |
301 | { | |
302 | /* When the position is not after the current position and in the same | |
303 | * line of the same buffer, need to restart parsing. */ | |
304 | --- 6088,6100 ---- | |
305 | * Function called for expression evaluation: get syntax ID at file position. | |
306 | */ | |
307 | int | |
308 | ! syn_get_id(wp, lnum, col, trans, spellp, keep_state) | |
309 | win_T *wp; | |
310 | long lnum; | |
311 | colnr_T col; | |
312 | ! int trans; /* remove transparancy */ | |
313 | ! int *spellp; /* return: can do spell checking */ | |
314 | ! int keep_state; /* keep state of char at "col" */ | |
315 | { | |
316 | /* When the position is not after the current position and in the same | |
317 | * line of the same buffer, need to restart parsing. */ | |
318 | *************** | |
319 | *** 6100,6106 **** | |
320 | || col < current_col) | |
321 | syntax_start(wp, lnum); | |
322 | ||
323 | ! (void)get_syntax_attr(col, spellp); | |
324 | ||
325 | return (trans ? current_trans_id : current_id); | |
326 | } | |
327 | --- 6103,6109 ---- | |
328 | || col < current_col) | |
329 | syntax_start(wp, lnum); | |
330 | ||
331 | ! (void)get_syntax_attr(col, spellp, keep_state); | |
332 | ||
333 | return (trans ? current_trans_id : current_id); | |
334 | } | |
335 | *************** | |
336 | *** 6115,6122 **** | |
337 | syn_get_stack_item(i) | |
338 | int i; | |
339 | { | |
340 | ! if (i >= current_state.ga_len ) | |
341 | return -1; | |
342 | return CUR_STATE(i).si_id; | |
343 | } | |
344 | #endif | |
345 | --- 6118,6131 ---- | |
346 | syn_get_stack_item(i) | |
347 | int i; | |
348 | { | |
349 | ! if (i >= current_state.ga_len) | |
350 | ! { | |
351 | ! /* Need to invalidate the state, because we didn't properly finish it | |
352 | ! * for the last character, "keep_state" was TRUE. */ | |
353 | ! invalidate_current_state(); | |
354 | ! current_col = MAXCOL; | |
355 | return -1; | |
356 | + } | |
357 | return CUR_STATE(i).si_id; | |
358 | } | |
359 | #endif | |
360 | *** ../vim-7.1.218/src/version.c Fri Jan 11 21:26:49 2008 | |
361 | --- src/version.c Sat Jan 12 16:40:47 2008 | |
362 | *************** | |
363 | *** 668,669 **** | |
364 | --- 668,671 ---- | |
365 | { /* Add new patch number below this line */ | |
366 | + /**/ | |
367 | + 219, | |
368 | /**/ | |
369 | ||
370 | -- | |
371 | ARTHUR: Go on, Bors, chop its head off. | |
372 | BORS: Right. Silly little bleeder. One rabbit stew coming up. | |
373 | "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD | |
374 | ||
375 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
376 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
377 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
378 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |