changeset 991:ddafd2ba3a86 v7.0.117

updated for version 7.0-117
author vimboss
date Tue, 03 Oct 2006 15:04:36 +0000
parents 9adbd26f7fee
children 144ad7f25f67
files src/syntax.c src/version.c
diffstat 2 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -977,6 +977,7 @@ syn_update_ends(startofline)
 {
     stateitem_T	*cur_si;
     int		i;
+    int		seen_keepend;
 
     if (startofline)
     {
@@ -1002,7 +1003,10 @@ syn_update_ends(startofline)
     /*
      * Need to update the end of a start/skip/end that continues from the
      * previous line.  And regions that have "keepend", because they may
-     * influence contained items.
+     * influence contained items.  If we've just removed "extend"
+     * (startofline == 0) then we should update ends of normal regions
+     * contained inside "keepend" because "extend" could have extended
+     * these "keepend" regions as well as contained normal regions.
      * Then check for items ending in column 0.
      */
     i = current_state.ga_len - 1;
@@ -1010,10 +1014,13 @@ syn_update_ends(startofline)
 	for ( ; i > keepend_level; --i)
 	    if (CUR_STATE(i).si_flags & HL_EXTEND)
 		break;
+
+    seen_keepend = FALSE;
     for ( ; i < current_state.ga_len; ++i)
     {
 	cur_si = &CUR_STATE(i);
 	if ((cur_si->si_flags & HL_KEEPEND)
+			    || (seen_keepend && !startofline)
 			    || (i == current_state.ga_len - 1 && startofline))
 	{
 	    cur_si->si_h_startpos.col = 0;	/* start highl. in col 0 */
@@ -1021,6 +1028,9 @@ syn_update_ends(startofline)
 
 	    if (!(cur_si->si_flags & HL_MATCHCONT))
 		update_si_end(cur_si, (int)current_col, !startofline);
+
+	    if (!startofline && (cur_si->si_flags & HL_KEEPEND))
+		seen_keepend = TRUE;
 	}
     }
     check_keepend();
@@ -2564,6 +2574,7 @@ check_keepend()
 {
     int		i;
     lpos_T	maxpos;
+    lpos_T	maxpos_h;
     stateitem_T	*sip;
 
     /*
@@ -2583,23 +2594,30 @@ check_keepend()
 	    break;
 
     maxpos.lnum = 0;
+    maxpos_h.lnum = 0;
     for ( ; i < current_state.ga_len; ++i)
     {
 	sip = &CUR_STATE(i);
 	if (maxpos.lnum != 0)
 	{
 	    limit_pos_zero(&sip->si_m_endpos, &maxpos);
-	    limit_pos_zero(&sip->si_h_endpos, &maxpos);
+	    limit_pos_zero(&sip->si_h_endpos, &maxpos_h);
 	    limit_pos_zero(&sip->si_eoe_pos, &maxpos);
 	    sip->si_ends = TRUE;
 	}
-	if (sip->si_ends
-		&& (sip->si_flags & HL_KEEPEND)
-		&& (maxpos.lnum == 0
+	if (sip->si_ends && (sip->si_flags & HL_KEEPEND))
+	{
+	    if (maxpos.lnum == 0
 		    || maxpos.lnum > sip->si_m_endpos.lnum
 		    || (maxpos.lnum == sip->si_m_endpos.lnum
-			&& maxpos.col > sip->si_m_endpos.col)))
-	    maxpos = sip->si_m_endpos;
+			&& maxpos.col > sip->si_m_endpos.col))
+		maxpos = sip->si_m_endpos;
+	    if (maxpos_h.lnum == 0
+		    || maxpos_h.lnum > sip->si_h_endpos.lnum
+		    || (maxpos_h.lnum == sip->si_h_endpos.lnum
+			&& maxpos_h.col > sip->si_h_endpos.col))
+		maxpos_h = sip->si_h_endpos;
+	}
     }
 }
 
--- a/src/version.c
+++ b/src/version.c
@@ -667,6 +667,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    117,
+/**/
     116,
 /**/
     115,