]>
Commit | Line | Data |
---|---|---|
0a7814d6 AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.086 | |
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.086 | |
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. | |
14 | Files: src/syntax.c | |
15 | ||
16 | ||
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 | |
19 | *************** | |
20 | *** 279,285 **** | |
21 | */ | |
22 | typedef struct state_item | |
23 | { | |
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 */ | |
28 | --- 279,286 ---- | |
29 | */ | |
30 | typedef struct state_item | |
31 | { | |
32 | ! int si_idx; /* index of syntax pattern or | |
33 | ! KEYWORD_IDX */ | |
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 */ | |
37 | *************** | |
38 | *** 837,845 **** | |
39 | current_lnum = end_lnum; | |
40 | break; | |
41 | } | |
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; | |
48 | --- 838,855 ---- | |
49 | current_lnum = end_lnum; | |
50 | break; | |
51 | } | |
52 | ! if (cur_si->si_idx < 0) | |
53 | ! { | |
54 | ! /* Cannot happen? */ | |
55 | ! found_flags = 0; | |
56 | ! found_match_idx = KEYWORD_IDX; | |
57 | ! } | |
58 | ! else | |
59 | ! { | |
60 | ! spp = &(SYN_ITEMS(syn_buf)[cur_si->si_idx]); | |
61 | ! found_flags = spp->sp_flags; | |
62 | ! found_match_idx = spp->sp_sync_idx; | |
63 | ! } | |
64 | found_current_lnum = current_lnum; | |
65 | found_current_col = current_col; | |
66 | found_m_endpos = cur_si->si_m_endpos; | |
67 | *************** | |
68 | *** 2533,2538 **** | |
69 | --- 2543,2552 ---- | |
70 | stateitem_T *sip = &CUR_STATE(idx); | |
71 | synpat_T *spp; | |
72 | ||
73 | + /* This should not happen... */ | |
74 | + if (sip->si_idx < 0) | |
75 | + return; | |
76 | + | |
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; | |
80 | *************** | |
81 | *** 2648,2653 **** | |
82 | --- 2662,2671 ---- | |
83 | lpos_T end_endpos; | |
84 | int end_idx; | |
85 | ||
86 | + /* return quickly for a keyword */ | |
87 | + if (sip->si_idx < 0) | |
88 | + return; | |
89 | + | |
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. */ | |
93 | *************** | |
94 | *** 2759,2764 **** | |
95 | --- 2777,2786 ---- | |
96 | lpos_T pos; | |
97 | char_u *line; | |
98 | int had_match = FALSE; | |
99 | + | |
100 | + /* just in case we are invoked for a keyword */ | |
101 | + if (idx < 0) | |
102 | + return; | |
103 | ||
104 | /* | |
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 | |
108 | *************** | |
109 | *** 668,669 **** | |
110 | --- 668,671 ---- | |
111 | { /* Add new patch number below this line */ | |
112 | + /**/ | |
113 | + 86, | |
114 | /**/ | |
115 | ||
116 | -- | |
117 | hundred-and-one symptoms of being an internet addict: | |
118 | 222. You send more than 20 personal e-mails a day. | |
119 | ||
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 /// |