4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
22 ! *eval.txt* For Vim version 7.1. Last change: 2008 Jan 10
25 VIM REFERENCE MANUAL by Bram Moolenaar
27 ! *eval.txt* For Vim version 7.1. Last change: 2008 Jan 11
30 VIM REFERENCE MANUAL by Bram Moolenaar
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
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
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);
54 rettv->vval.v_number = id;
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);
62 rettv->vval.v_number = id;
65 && col >= 0 && col < (long)STRLEN(ml_get(lnum))
66 && rettv_list_alloc(rettv) != FAIL)
68 ! (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL);
71 id = syn_get_stack_item(i);
73 && col >= 0 && col < (long)STRLEN(ml_get(lnum))
74 && rettv_list_alloc(rettv) != FAIL)
76 ! (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
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
85 if (psettings->do_syntax)
87 ! id = syn_get_id(curwin, ppos->file_line, col, 1, NULL);
89 id = syn_get_final_id(id);
93 if (psettings->do_syntax)
95 ! id = syn_get_id(curwin, ppos->file_line, col, 1, NULL, FALSE);
97 id = syn_get_final_id(id);
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
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));
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));
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));
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
140 has_spell ? &can_spell :
148 has_spell ? &can_spell :
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
159 col = (int)(p - buf);
160 (void)syn_get_id(wp, lnum, (colnr_T)col,
161 ! FALSE, &can_spell);
167 col = (int)(p - buf);
168 (void)syn_get_id(wp, lnum, (colnr_T)col,
169 ! FALSE, &can_spell, FALSE);
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
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));
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));
195 while (!current_finished)
197 ! (void)syn_current_attr(syncing, FALSE, NULL);
199 * When syncing, and found some item, need to check the item.
203 while (!current_finished)
205 ! (void)syn_current_attr(syncing, FALSE, NULL, FALSE);
207 * When syncing, and found some item, need to check the item.
214 ! get_syntax_attr(col, can_spell)
224 ! get_syntax_attr(col, can_spell, keep_state)
227 + int keep_state; /* keep state of char at "col" */
234 while (current_col <= col)
236 ! attr = syn_current_attr(FALSE, TRUE, can_spell);
242 while (current_col <= col)
244 ! attr = syn_current_attr(FALSE, TRUE, can_spell,
245 ! current_col == col ? keep_state : FALSE);
251 * Get syntax attributes for current_lnum, current_col.
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 */
260 lpos_T endpos; /* was: char_u *endp; */
262 * Get syntax attributes for current_lnum, current_col.
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 */
272 lpos_T endpos; /* was: char_u *endp; */
275 * may be for an empty match and a containing item might end in the
281 if (current_state.ga_len > 0
283 * may be for an empty match and a containing item might end in the
286 ! if (!syncing && !keep_state)
289 if (current_state.ga_len > 0
292 * Function called for expression evaluation: get syntax ID at file position.
295 ! syn_get_id(wp, lnum, col, trans, spellp)
299 ! int trans; /* remove transparancy */
300 ! int *spellp; /* return: can do spell checking */
302 /* When the position is not after the current position and in the same
303 * line of the same buffer, need to restart parsing. */
305 * Function called for expression evaluation: get syntax ID at file position.
308 ! syn_get_id(wp, lnum, col, trans, spellp, keep_state)
312 ! int trans; /* remove transparancy */
313 ! int *spellp; /* return: can do spell checking */
314 ! int keep_state; /* keep state of char at "col" */
316 /* When the position is not after the current position and in the same
317 * line of the same buffer, need to restart parsing. */
320 || col < current_col)
321 syntax_start(wp, lnum);
323 ! (void)get_syntax_attr(col, spellp);
325 return (trans ? current_trans_id : current_id);
328 || col < current_col)
329 syntax_start(wp, lnum);
331 ! (void)get_syntax_attr(col, spellp, keep_state);
333 return (trans ? current_trans_id : current_id);
337 syn_get_stack_item(i)
340 ! if (i >= current_state.ga_len )
342 return CUR_STATE(i).si_id;
346 syn_get_stack_item(i)
349 ! if (i >= current_state.ga_len)
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;
357 return CUR_STATE(i).si_id;
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
365 { /* Add new patch number below this line */
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
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 ///