Mercurial > vim
comparison src/syntax.c @ 819:23f82b5d2814 v7.0c10
updated for version 7.0c10
author | vimboss |
---|---|
date | Wed, 05 Apr 2006 20:41:53 +0000 |
parents | 1f929f3ca806 |
children | 5117153003bd |
comparison
equal
deleted
inserted
replaced
818:1f929f3ca806 | 819:23f82b5d2814 |
---|---|
549 | 549 |
550 /* | 550 /* |
551 * Advance from the sync point or saved state until the current line. | 551 * Advance from the sync point or saved state until the current line. |
552 * Save some entries for syncing with later on. | 552 * Save some entries for syncing with later on. |
553 */ | 553 */ |
554 dist = syn_buf->b_ml.ml_line_count / (syn_buf->b_sst_len - Rows) + 1; | 554 if (syn_buf->b_sst_len <= Rows) |
555 dist = 999999; | |
556 else | |
557 dist = syn_buf->b_ml.ml_line_count / (syn_buf->b_sst_len - Rows) + 1; | |
555 prev = syn_stack_find_entry(current_lnum); | 558 prev = syn_stack_find_entry(current_lnum); |
556 while (current_lnum < lnum) | 559 while (current_lnum < lnum) |
557 { | 560 { |
558 syn_start_line(); | 561 syn_start_line(); |
559 (void)syn_finish_line(FALSE); | 562 (void)syn_finish_line(FALSE); |
1238 | 1241 |
1239 if (syn_buf->b_sst_array == NULL || syn_buf->b_sst_first == NULL) | 1242 if (syn_buf->b_sst_array == NULL || syn_buf->b_sst_first == NULL) |
1240 return retval; | 1243 return retval; |
1241 | 1244 |
1242 /* Compute normal distance between non-displayed entries. */ | 1245 /* Compute normal distance between non-displayed entries. */ |
1243 dist = syn_buf->b_ml.ml_line_count / (syn_buf->b_sst_len - Rows) + 1; | 1246 if (syn_buf->b_sst_len <= Rows) |
1247 dist = 999999; | |
1248 else | |
1249 dist = syn_buf->b_ml.ml_line_count / (syn_buf->b_sst_len - Rows) + 1; | |
1244 | 1250 |
1245 /* | 1251 /* |
1246 * Go throught the list to find the "tick" for the oldest entry that can | 1252 * Go throught the list to find the "tick" for the oldest entry that can |
1247 * be removed. Set "above" when the "tick" for the oldest entry is above | 1253 * be removed. Set "above" when the "tick" for the oldest entry is above |
1248 * "b_sst_lasttick" (the display tick wraps around). | 1254 * "b_sst_lasttick" (the display tick wraps around). |
4434 prev_syn_inc_tag = current_syn_inc_tag; | 4440 prev_syn_inc_tag = current_syn_inc_tag; |
4435 current_syn_inc_tag = ++running_syn_inc_tag; | 4441 current_syn_inc_tag = ++running_syn_inc_tag; |
4436 prev_toplvl_grp = curbuf->b_syn_topgrp; | 4442 prev_toplvl_grp = curbuf->b_syn_topgrp; |
4437 curbuf->b_syn_topgrp = sgl_id; | 4443 curbuf->b_syn_topgrp = sgl_id; |
4438 if (source ? do_source(eap->arg, FALSE, FALSE) == FAIL | 4444 if (source ? do_source(eap->arg, FALSE, FALSE) == FAIL |
4439 : source_runtime(eap->arg, TRUE) == FAIL) | 4445 : source_runtime(eap->arg, DOSO_NONE) == FAIL) |
4440 EMSG2(_(e_notopen), eap->arg); | 4446 EMSG2(_(e_notopen), eap->arg); |
4441 curbuf->b_syn_topgrp = prev_toplvl_grp; | 4447 curbuf->b_syn_topgrp = prev_toplvl_grp; |
4442 current_syn_inc_tag = prev_syn_inc_tag; | 4448 current_syn_inc_tag = prev_syn_inc_tag; |
4443 } | 4449 } |
4444 | 4450 |
7268 else | 7274 else |
7269 set_hl_attr(idx); | 7275 set_hl_attr(idx); |
7270 #ifdef FEAT_EVAL | 7276 #ifdef FEAT_EVAL |
7271 HL_TABLE()[idx].sg_scriptID = current_SID; | 7277 HL_TABLE()[idx].sg_scriptID = current_SID; |
7272 #endif | 7278 #endif |
7273 redraw_all_later(SOME_VALID); | 7279 redraw_all_later(NOT_VALID); |
7274 } | 7280 } |
7275 vim_free(key); | 7281 vim_free(key); |
7276 vim_free(arg); | 7282 vim_free(arg); |
7277 | 7283 |
7278 /* Only call highlight_changed() once, after sourcing a syntax file */ | 7284 /* Only call highlight_changed() once, after sourcing a syntax file */ |
8424 highlight_exists(name) | 8430 highlight_exists(name) |
8425 char_u *name; | 8431 char_u *name; |
8426 { | 8432 { |
8427 return (syn_name2id(name) > 0); | 8433 return (syn_name2id(name) > 0); |
8428 } | 8434 } |
8435 | |
8436 # if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) | |
8437 /* | |
8438 * Return the name of highlight group "id". | |
8439 * When not a valid ID return an empty string. | |
8440 */ | |
8441 char_u * | |
8442 syn_id2name(id) | |
8443 int id; | |
8444 { | |
8445 if (id <= 0 || id >= highlight_ga.ga_len) | |
8446 return (char_u *)""; | |
8447 return HL_TABLE()[id - 1].sg_name; | |
8448 } | |
8449 # endif | |
8429 #endif | 8450 #endif |
8430 | 8451 |
8431 /* | 8452 /* |
8432 * Like syn_name2id(), but take a pointer + length argument. | 8453 * Like syn_name2id(), but take a pointer + length argument. |
8433 */ | 8454 */ |