4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Crash when using specific Python syntax highlighting. (Quirk)
12 Solution: Check for a negative index, coming from a keyword match at the
13 start of a line from a saved state.
17 *** ../vim-7.1.085/src/syntax.c Tue Aug 14 23:06:51 2007
18 --- src/syntax.c Tue Aug 21 17:13:51 2007
22 typedef struct state_item
24 ! int si_idx; /* index of syntax pattern */
25 int si_id; /* highlight group ID for keywords */
26 int si_trans_id; /* idem, transparancy removed */
27 int si_m_lnum; /* lnum of the match */
30 typedef struct state_item
32 ! int si_idx; /* index of syntax pattern or
34 int si_id; /* highlight group ID for keywords */
35 int si_trans_id; /* idem, transparancy removed */
36 int si_m_lnum; /* lnum of the match */
39 current_lnum = end_lnum;
42 ! spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]);
43 ! found_flags = spp->sp_flags;
44 ! found_match_idx = spp->sp_sync_idx;
45 found_current_lnum = current_lnum;
46 found_current_col = current_col;
47 found_m_endpos = cur_si->si_m_endpos;
49 current_lnum = end_lnum;
52 ! if (cur_si->si_idx < 0)
54 ! /* Cannot happen? */
56 ! found_match_idx = KEYWORD_IDX;
60 ! spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]);
61 ! found_flags = spp->sp_flags;
62 ! found_match_idx = spp->sp_sync_idx;
64 found_current_lnum = current_lnum;
65 found_current_col = current_col;
66 found_m_endpos = cur_si->si_m_endpos;
70 stateitem_T *sip = &CUR_STATE(idx);
73 + /* This should not happen... */
74 + if (sip->si_idx < 0)
77 spp = &(SYN_ITEMS(syn_buf)[sip->si_idx]);
78 if (sip->si_flags & HL_MATCH)
79 sip->si_id = spp->sp_syn_match_id;
86 + /* return quickly for a keyword */
87 + if (sip->si_idx < 0)
90 /* Don't update when it's already done. Can be a match of an end pattern
91 * that started in a previous line. Watch out: can also be a "keepend"
92 * from a containing item. */
98 int had_match = FALSE;
100 + /* just in case we are invoked for a keyword */
105 * Check for being called with a START pattern.
106 *** ../vim-7.1.085/src/version.c Tue Aug 21 15:28:32 2007
107 --- src/version.c Tue Aug 21 17:21:06 2007
111 { /* Add new patch number below this line */
117 hundred-and-one symptoms of being an internet addict:
118 222. You send more than 20 personal e-mails a day.
120 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
121 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
122 \\\ download, build and distribute -- http://www.A-A-P.org ///
123 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///