Mercurial > vim
comparison src/syntax.c @ 2863:8d8bd6307b1a v7.3.205
updated for version 7.3.205
Problem: Syntax "extend" doesn't work correctly.
Solution: Avoid calling check_state_ends() recursively (Ben Schmidt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 25 May 2011 17:56:27 +0200 |
parents | 30b7cde21940 |
children | 8477b2cc2b81 |
comparison
equal
deleted
inserted
replaced
2862:eaf92a6745ec | 2863:8d8bd6307b1a |
---|---|
988 /* | 988 /* |
989 * Need to update the end of a start/skip/end that continues from the | 989 * Need to update the end of a start/skip/end that continues from the |
990 * previous line and regions that have "keepend". | 990 * previous line and regions that have "keepend". |
991 */ | 991 */ |
992 if (current_state.ga_len > 0) | 992 if (current_state.ga_len > 0) |
993 { | |
993 syn_update_ends(TRUE); | 994 syn_update_ends(TRUE); |
995 check_state_ends(); | |
996 } | |
994 | 997 |
995 next_match_idx = -1; | 998 next_match_idx = -1; |
996 ++current_line_id; | 999 ++current_line_id; |
997 } | 1000 } |
998 | 1001 |
1062 if (!startofline && (cur_si->si_flags & HL_KEEPEND)) | 1065 if (!startofline && (cur_si->si_flags & HL_KEEPEND)) |
1063 seen_keepend = TRUE; | 1066 seen_keepend = TRUE; |
1064 } | 1067 } |
1065 } | 1068 } |
1066 check_keepend(); | 1069 check_keepend(); |
1067 check_state_ends(); | |
1068 } | 1070 } |
1069 | 1071 |
1070 /**************************************** | 1072 /**************************************** |
1071 * Handling of the state stack cache. | 1073 * Handling of the state stack cache. |
1072 */ | 1074 */ |
2531 */ | 2533 */ |
2532 static void | 2534 static void |
2533 check_state_ends() | 2535 check_state_ends() |
2534 { | 2536 { |
2535 stateitem_T *cur_si; | 2537 stateitem_T *cur_si; |
2536 int had_extend = FALSE; | 2538 int had_extend; |
2537 | 2539 |
2538 cur_si = &CUR_STATE(current_state.ga_len - 1); | 2540 cur_si = &CUR_STATE(current_state.ga_len - 1); |
2539 for (;;) | 2541 for (;;) |
2540 { | 2542 { |
2541 if (cur_si->si_ends | 2543 if (cur_si->si_ends |
2584 && syn_getcurline()[current_col] == NUL) | 2586 && syn_getcurline()[current_col] == NUL) |
2585 current_next_list = NULL; | 2587 current_next_list = NULL; |
2586 | 2588 |
2587 /* When the ended item has "extend", another item with | 2589 /* When the ended item has "extend", another item with |
2588 * "keepend" now needs to check for its end. */ | 2590 * "keepend" now needs to check for its end. */ |
2589 if (cur_si->si_flags & HL_EXTEND) | 2591 had_extend = (cur_si->si_flags & HL_EXTEND); |
2590 had_extend = TRUE; | |
2591 | 2592 |
2592 pop_current_state(); | 2593 pop_current_state(); |
2593 | 2594 |
2594 if (current_state.ga_len == 0) | 2595 if (current_state.ga_len == 0) |
2595 break; | 2596 break; |