Mercurial > vim
comparison src/syntax.c @ 2425:b5ee68272ae5 vim73
Fix: concealed regions didn't get redrawn correctly when moving the cursor
through them.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 28 Jul 2010 18:14:45 +0200 |
parents | da067045878f |
children | 6768ebd0bc04 |
comparison
equal
deleted
inserted
replaced
2424:ee4e1e140117 | 2425:b5ee68272ae5 |
---|---|
143 { | 143 { |
144 char sp_type; /* see SPTYPE_ defines below */ | 144 char sp_type; /* see SPTYPE_ defines below */ |
145 char sp_syncing; /* this item used for syncing */ | 145 char sp_syncing; /* this item used for syncing */ |
146 int sp_flags; /* see HL_ defines below */ | 146 int sp_flags; /* see HL_ defines below */ |
147 #ifdef FEAT_CONCEAL | 147 #ifdef FEAT_CONCEAL |
148 int sp_char; /* conceal substitute character */ | 148 int sp_cchar; /* conceal substitute character */ |
149 #endif | 149 #endif |
150 struct sp_syn sp_syn; /* struct passed to in_id_list() */ | 150 struct sp_syn sp_syn; /* struct passed to in_id_list() */ |
151 short sp_syn_match_id; /* highlight group ID of pattern */ | 151 short sp_syn_match_id; /* highlight group ID of pattern */ |
152 char_u *sp_pattern; /* regexp to match, pattern */ | 152 char_u *sp_pattern; /* regexp to match, pattern */ |
153 regprog_T *sp_prog; /* regexp to match, program */ | 153 regprog_T *sp_prog; /* regexp to match, program */ |
194 #ifdef FEAT_EVAL | 194 #ifdef FEAT_EVAL |
195 static int current_id = 0; /* ID of current char for syn_get_id() */ | 195 static int current_id = 0; /* ID of current char for syn_get_id() */ |
196 static int current_trans_id = 0; /* idem, transparency removed */ | 196 static int current_trans_id = 0; /* idem, transparency removed */ |
197 #endif | 197 #endif |
198 #ifdef FEAT_CONCEAL | 198 #ifdef FEAT_CONCEAL |
199 static int current_flags = 0; | |
199 static int current_seqnr = 0; | 200 static int current_seqnr = 0; |
200 static int current_flags = 0; | |
201 static int current_sub_char = 0; | 201 static int current_sub_char = 0; |
202 #endif | 202 #endif |
203 | 203 |
204 typedef struct syn_cluster_S | 204 typedef struct syn_cluster_S |
205 { | 205 { |
285 int si_ends; /* if match ends before si_m_endpos */ | 285 int si_ends; /* if match ends before si_m_endpos */ |
286 int si_attr; /* attributes in this state */ | 286 int si_attr; /* attributes in this state */ |
287 long si_flags; /* HL_HAS_EOL flag in this state, and | 287 long si_flags; /* HL_HAS_EOL flag in this state, and |
288 * HL_SKIP* for si_next_list */ | 288 * HL_SKIP* for si_next_list */ |
289 #ifdef FEAT_CONCEAL | 289 #ifdef FEAT_CONCEAL |
290 int si_char; /* substitution character for conceal */ | |
291 int si_seqnr; /* sequence number */ | 290 int si_seqnr; /* sequence number */ |
291 int si_cchar; /* substitution character for conceal */ | |
292 #endif | 292 #endif |
293 short *si_cont_list; /* list of contained groups */ | 293 short *si_cont_list; /* list of contained groups */ |
294 short *si_next_list; /* nextgroup IDs after this item ends */ | 294 short *si_next_list; /* nextgroup IDs after this item ends */ |
295 reg_extmatch_T *si_extmatch; /* \z(...\) matches from start | 295 reg_extmatch_T *si_extmatch; /* \z(...\) matches from start |
296 * pattern */ | 296 * pattern */ |
1493 bp = sp->sst_union.sst_stack; | 1493 bp = sp->sst_union.sst_stack; |
1494 for (i = 0; i < sp->sst_stacksize; ++i) | 1494 for (i = 0; i < sp->sst_stacksize; ++i) |
1495 { | 1495 { |
1496 bp[i].bs_idx = CUR_STATE(i).si_idx; | 1496 bp[i].bs_idx = CUR_STATE(i).si_idx; |
1497 bp[i].bs_flags = CUR_STATE(i).si_flags; | 1497 bp[i].bs_flags = CUR_STATE(i).si_flags; |
1498 #ifdef FEAT_CONCEAL | |
1499 bp[i].bs_seqnr = CUR_STATE(i).si_seqnr; | |
1500 bp[i].bs_cchar = CUR_STATE(i).si_cchar; | |
1501 #endif | |
1498 bp[i].bs_extmatch = ref_extmatch(CUR_STATE(i).si_extmatch); | 1502 bp[i].bs_extmatch = ref_extmatch(CUR_STATE(i).si_extmatch); |
1499 } | 1503 } |
1500 sp->sst_next_flags = current_next_flags; | 1504 sp->sst_next_flags = current_next_flags; |
1501 sp->sst_next_list = current_next_list; | 1505 sp->sst_next_list = current_next_list; |
1502 sp->sst_tick = display_tick; | 1506 sp->sst_tick = display_tick; |
1528 bp = from->sst_union.sst_stack; | 1532 bp = from->sst_union.sst_stack; |
1529 for (i = 0; i < from->sst_stacksize; ++i) | 1533 for (i = 0; i < from->sst_stacksize; ++i) |
1530 { | 1534 { |
1531 CUR_STATE(i).si_idx = bp[i].bs_idx; | 1535 CUR_STATE(i).si_idx = bp[i].bs_idx; |
1532 CUR_STATE(i).si_flags = bp[i].bs_flags; | 1536 CUR_STATE(i).si_flags = bp[i].bs_flags; |
1537 #ifdef FEAT_CONCEAL | |
1538 CUR_STATE(i).si_seqnr = bp[i].bs_seqnr; | |
1539 CUR_STATE(i).si_cchar = bp[i].bs_cchar; | |
1540 #endif | |
1533 CUR_STATE(i).si_extmatch = ref_extmatch(bp[i].bs_extmatch); | 1541 CUR_STATE(i).si_extmatch = ref_extmatch(bp[i].bs_extmatch); |
1534 if (keepend_level < 0 && (CUR_STATE(i).si_flags & HL_KEEPEND)) | 1542 if (keepend_level < 0 && (CUR_STATE(i).si_flags & HL_KEEPEND)) |
1535 keepend_level = i; | 1543 keepend_level = i; |
1536 CUR_STATE(i).si_ends = FALSE; | 1544 CUR_STATE(i).si_ends = FALSE; |
1537 CUR_STATE(i).si_m_lnum = 0; | 1545 CUR_STATE(i).si_m_lnum = 0; |
1961 cur_si->si_ends = TRUE; | 1969 cur_si->si_ends = TRUE; |
1962 cur_si->si_end_idx = 0; | 1970 cur_si->si_end_idx = 0; |
1963 cur_si->si_flags = flags; | 1971 cur_si->si_flags = flags; |
1964 #ifdef FEAT_CONCEAL | 1972 #ifdef FEAT_CONCEAL |
1965 cur_si->si_seqnr = next_seqnr++; | 1973 cur_si->si_seqnr = next_seqnr++; |
1966 cur_si->si_char = cchar; | 1974 cur_si->si_cchar = cchar; |
1967 if (current_state.ga_len > 1) | 1975 if (current_state.ga_len > 1) |
1968 cur_si->si_flags |= | 1976 cur_si->si_flags |= |
1969 CUR_STATE(current_state.ga_len - 2).si_flags | 1977 CUR_STATE(current_state.ga_len - 2).si_flags |
1970 & HL_CONCEAL; | 1978 & HL_CONCEAL; |
1971 #endif | 1979 #endif |
2291 current_id = sip->si_id; | 2299 current_id = sip->si_id; |
2292 #endif | 2300 #endif |
2293 current_trans_id = sip->si_trans_id; | 2301 current_trans_id = sip->si_trans_id; |
2294 #ifdef FEAT_CONCEAL | 2302 #ifdef FEAT_CONCEAL |
2295 current_flags = sip->si_flags; | 2303 current_flags = sip->si_flags; |
2296 current_sub_char = sip->si_char; | |
2297 current_seqnr = sip->si_seqnr; | 2304 current_seqnr = sip->si_seqnr; |
2305 current_sub_char = sip->si_cchar; | |
2298 #endif | 2306 #endif |
2299 break; | 2307 break; |
2300 } | 2308 } |
2301 } | 2309 } |
2302 | 2310 |
2447 cur_si->si_m_startcol = current_col; | 2455 cur_si->si_m_startcol = current_col; |
2448 cur_si->si_m_lnum = current_lnum; | 2456 cur_si->si_m_lnum = current_lnum; |
2449 cur_si->si_flags = spp->sp_flags; | 2457 cur_si->si_flags = spp->sp_flags; |
2450 #ifdef FEAT_CONCEAL | 2458 #ifdef FEAT_CONCEAL |
2451 cur_si->si_seqnr = next_seqnr++; | 2459 cur_si->si_seqnr = next_seqnr++; |
2452 cur_si->si_char = spp->sp_char; | 2460 cur_si->si_cchar = spp->sp_cchar; |
2453 if (current_state.ga_len > 1) | 2461 if (current_state.ga_len > 1) |
2454 cur_si->si_flags |= | 2462 cur_si->si_flags |= |
2455 CUR_STATE(current_state.ga_len - 2).si_flags & HL_CONCEAL; | 2463 CUR_STATE(current_state.ga_len - 2).si_flags & HL_CONCEAL; |
2456 #endif | 2464 #endif |
2457 cur_si->si_next_list = spp->sp_next_list; | 2465 cur_si->si_next_list = spp->sp_next_list; |
4883 SYN_ITEMS(curwin->w_s)[idx].sp_sync_idx = sync_idx; | 4891 SYN_ITEMS(curwin->w_s)[idx].sp_sync_idx = sync_idx; |
4884 SYN_ITEMS(curwin->w_s)[idx].sp_cont_list = syn_opt_arg.cont_list; | 4892 SYN_ITEMS(curwin->w_s)[idx].sp_cont_list = syn_opt_arg.cont_list; |
4885 SYN_ITEMS(curwin->w_s)[idx].sp_syn.cont_in_list = | 4893 SYN_ITEMS(curwin->w_s)[idx].sp_syn.cont_in_list = |
4886 syn_opt_arg.cont_in_list; | 4894 syn_opt_arg.cont_in_list; |
4887 #ifdef FEAT_CONCEAL | 4895 #ifdef FEAT_CONCEAL |
4888 SYN_ITEMS(curwin->w_s)[idx].sp_char = conceal_char; | 4896 SYN_ITEMS(curwin->w_s)[idx].sp_cchar = conceal_char; |
4889 #endif | 4897 #endif |
4890 if (syn_opt_arg.cont_in_list != NULL) | 4898 if (syn_opt_arg.cont_in_list != NULL) |
4891 curwin->w_s->b_syn_containedin = TRUE; | 4899 curwin->w_s->b_syn_containedin = TRUE; |
4892 SYN_ITEMS(curwin->w_s)[idx].sp_next_list = syn_opt_arg.next_list; | 4900 SYN_ITEMS(curwin->w_s)[idx].sp_next_list = syn_opt_arg.next_list; |
4893 ++curwin->w_s->b_syn_patterns.ga_len; | 4901 ++curwin->w_s->b_syn_patterns.ga_len; |
5127 SYN_ITEMS(curwin->w_s)[idx].sp_syn.id = syn_id; | 5135 SYN_ITEMS(curwin->w_s)[idx].sp_syn.id = syn_id; |
5128 SYN_ITEMS(curwin->w_s)[idx].sp_syn.inc_tag = current_syn_inc_tag; | 5136 SYN_ITEMS(curwin->w_s)[idx].sp_syn.inc_tag = current_syn_inc_tag; |
5129 SYN_ITEMS(curwin->w_s)[idx].sp_syn_match_id = | 5137 SYN_ITEMS(curwin->w_s)[idx].sp_syn_match_id = |
5130 ppp->pp_matchgroup_id; | 5138 ppp->pp_matchgroup_id; |
5131 #ifdef FEAT_CONCEAL | 5139 #ifdef FEAT_CONCEAL |
5132 SYN_ITEMS(curwin->w_s)[idx].sp_char = conceal_char; | 5140 SYN_ITEMS(curwin->w_s)[idx].sp_cchar = conceal_char; |
5133 #endif | 5141 #endif |
5134 if (item == ITEM_START) | 5142 if (item == ITEM_START) |
5135 { | 5143 { |
5136 SYN_ITEMS(curwin->w_s)[idx].sp_cont_list = | 5144 SYN_ITEMS(curwin->w_s)[idx].sp_cont_list = |
5137 syn_opt_arg.cont_list; | 5145 syn_opt_arg.cont_list; |