Karsten Hopp ef9663
To: vim-dev@vim.org
Karsten Hopp ef9663
Subject: Patch 7.0.117
Karsten Hopp ef9663
Fcc: outbox
Karsten Hopp ef9663
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ef9663
Mime-Version: 1.0
Karsten Hopp ef9663
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp ef9663
Content-Transfer-Encoding: 8bit
Karsten Hopp ef9663
------------
Karsten Hopp ef9663
Karsten Hopp ef9663
Patch 7.0.117
Karsten Hopp ef9663
Problem:    Using "extend" on a syntax item inside a region with "keepend", an
Karsten Hopp ef9663
	    intermediate item may be truncated.
Karsten Hopp ef9663
	    When applying the "keepend" and there is an offset to the end
Karsten Hopp ef9663
	    pattern the highlighting of a contained item isn't adjusted.
Karsten Hopp ef9663
Solution:   Use the seen_keepend flag to remember when to apply the "keepend"
Karsten Hopp ef9663
	    flag.  Adjust the keepend highlighting properly. (Ilya Bobir)
Karsten Hopp ef9663
Files:	    src/syntax.c
Karsten Hopp ef9663
Karsten Hopp ef9663
Karsten Hopp ef9663
*** ../vim-7.0.116/src/syntax.c	Thu Apr 27 01:58:59 2006
Karsten Hopp ef9663
--- src/syntax.c	Tue Oct  3 17:00:44 2006
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 977,982 ****
Karsten Hopp ef9663
--- 977,983 ----
Karsten Hopp ef9663
  {
Karsten Hopp ef9663
      stateitem_T	*cur_si;
Karsten Hopp ef9663
      int		i;
Karsten Hopp ef9663
+     int		seen_keepend;
Karsten Hopp ef9663
  
Karsten Hopp ef9663
      if (startofline)
Karsten Hopp ef9663
      {
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 1002,1008 ****
Karsten Hopp ef9663
      /*
Karsten Hopp ef9663
       * Need to update the end of a start/skip/end that continues from the
Karsten Hopp ef9663
       * previous line.  And regions that have "keepend", because they may
Karsten Hopp ef9663
!      * influence contained items.
Karsten Hopp ef9663
       * Then check for items ending in column 0.
Karsten Hopp ef9663
       */
Karsten Hopp ef9663
      i = current_state.ga_len - 1;
Karsten Hopp ef9663
--- 1003,1012 ----
Karsten Hopp ef9663
      /*
Karsten Hopp ef9663
       * Need to update the end of a start/skip/end that continues from the
Karsten Hopp ef9663
       * previous line.  And regions that have "keepend", because they may
Karsten Hopp ef9663
!      * influence contained items.  If we've just removed "extend"
Karsten Hopp ef9663
!      * (startofline == 0) then we should update ends of normal regions
Karsten Hopp ef9663
!      * contained inside "keepend" because "extend" could have extended
Karsten Hopp ef9663
!      * these "keepend" regions as well as contained normal regions.
Karsten Hopp ef9663
       * Then check for items ending in column 0.
Karsten Hopp ef9663
       */
Karsten Hopp ef9663
      i = current_state.ga_len - 1;
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 1010,1019 ****
Karsten Hopp ef9663
--- 1014,1026 ----
Karsten Hopp ef9663
  	for ( ; i > keepend_level; --i)
Karsten Hopp ef9663
  	    if (CUR_STATE(i).si_flags & HL_EXTEND)
Karsten Hopp ef9663
  		break;
Karsten Hopp ef9663
+ 
Karsten Hopp ef9663
+     seen_keepend = FALSE;
Karsten Hopp ef9663
      for ( ; i < current_state.ga_len; ++i)
Karsten Hopp ef9663
      {
Karsten Hopp ef9663
  	cur_si = &CUR_STATE(i);
Karsten Hopp ef9663
  	if ((cur_si->si_flags & HL_KEEPEND)
Karsten Hopp ef9663
+ 			    || (seen_keepend && !startofline)
Karsten Hopp ef9663
  			    || (i == current_state.ga_len - 1 && startofline))
Karsten Hopp ef9663
  	{
Karsten Hopp ef9663
  	    cur_si->si_h_startpos.col = 0;	/* start highl. in col 0 */
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 1021,1026 ****
Karsten Hopp ef9663
--- 1028,1036 ----
Karsten Hopp ef9663
  
Karsten Hopp ef9663
  	    if (!(cur_si->si_flags & HL_MATCHCONT))
Karsten Hopp ef9663
  		update_si_end(cur_si, (int)current_col, !startofline);
Karsten Hopp ef9663
+ 
Karsten Hopp ef9663
+ 	    if (!startofline && (cur_si->si_flags & HL_KEEPEND))
Karsten Hopp ef9663
+ 		seen_keepend = TRUE;
Karsten Hopp ef9663
  	}
Karsten Hopp ef9663
      }
Karsten Hopp ef9663
      check_keepend();
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 2564,2569 ****
Karsten Hopp ef9663
--- 2574,2580 ----
Karsten Hopp ef9663
  {
Karsten Hopp ef9663
      int		i;
Karsten Hopp ef9663
      lpos_T	maxpos;
Karsten Hopp ef9663
+     lpos_T	maxpos_h;
Karsten Hopp ef9663
      stateitem_T	*sip;
Karsten Hopp ef9663
  
Karsten Hopp ef9663
      /*
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 2583,2605 ****
Karsten Hopp ef9663
  	    break;
Karsten Hopp ef9663
  
Karsten Hopp ef9663
      maxpos.lnum = 0;
Karsten Hopp ef9663
      for ( ; i < current_state.ga_len; ++i)
Karsten Hopp ef9663
      {
Karsten Hopp ef9663
  	sip = &CUR_STATE(i);
Karsten Hopp ef9663
  	if (maxpos.lnum != 0)
Karsten Hopp ef9663
  	{
Karsten Hopp ef9663
  	    limit_pos_zero(&sip->si_m_endpos, &maxpos);
Karsten Hopp ef9663
! 	    limit_pos_zero(&sip->si_h_endpos, &maxpos);
Karsten Hopp ef9663
  	    limit_pos_zero(&sip->si_eoe_pos, &maxpos);
Karsten Hopp ef9663
  	    sip->si_ends = TRUE;
Karsten Hopp ef9663
  	}
Karsten Hopp ef9663
! 	if (sip->si_ends
Karsten Hopp ef9663
! 		&& (sip->si_flags & HL_KEEPEND)
Karsten Hopp ef9663
! 		&& (maxpos.lnum == 0
Karsten Hopp ef9663
  		    || maxpos.lnum > sip->si_m_endpos.lnum
Karsten Hopp ef9663
  		    || (maxpos.lnum == sip->si_m_endpos.lnum
Karsten Hopp ef9663
! 			&& maxpos.col > sip->si_m_endpos.col)))
Karsten Hopp ef9663
! 	    maxpos = sip->si_m_endpos;
Karsten Hopp ef9663
      }
Karsten Hopp ef9663
  }
Karsten Hopp ef9663
  
Karsten Hopp ef9663
--- 2594,2623 ----
Karsten Hopp ef9663
  	    break;
Karsten Hopp ef9663
  
Karsten Hopp ef9663
      maxpos.lnum = 0;
Karsten Hopp ef9663
+     maxpos_h.lnum = 0;
Karsten Hopp ef9663
      for ( ; i < current_state.ga_len; ++i)
Karsten Hopp ef9663
      {
Karsten Hopp ef9663
  	sip = &CUR_STATE(i);
Karsten Hopp ef9663
  	if (maxpos.lnum != 0)
Karsten Hopp ef9663
  	{
Karsten Hopp ef9663
  	    limit_pos_zero(&sip->si_m_endpos, &maxpos);
Karsten Hopp ef9663
! 	    limit_pos_zero(&sip->si_h_endpos, &maxpos_h);
Karsten Hopp ef9663
  	    limit_pos_zero(&sip->si_eoe_pos, &maxpos);
Karsten Hopp ef9663
  	    sip->si_ends = TRUE;
Karsten Hopp ef9663
  	}
Karsten Hopp ef9663
! 	if (sip->si_ends && (sip->si_flags & HL_KEEPEND))
Karsten Hopp ef9663
! 	{
Karsten Hopp ef9663
! 	    if (maxpos.lnum == 0
Karsten Hopp ef9663
  		    || maxpos.lnum > sip->si_m_endpos.lnum
Karsten Hopp ef9663
  		    || (maxpos.lnum == sip->si_m_endpos.lnum
Karsten Hopp ef9663
! 			&& maxpos.col > sip->si_m_endpos.col))
Karsten Hopp ef9663
! 		maxpos = sip->si_m_endpos;
Karsten Hopp ef9663
! 	    if (maxpos_h.lnum == 0
Karsten Hopp ef9663
! 		    || maxpos_h.lnum > sip->si_h_endpos.lnum
Karsten Hopp ef9663
! 		    || (maxpos_h.lnum == sip->si_h_endpos.lnum
Karsten Hopp ef9663
! 			&& maxpos_h.col > sip->si_h_endpos.col))
Karsten Hopp ef9663
! 		maxpos_h = sip->si_h_endpos;
Karsten Hopp ef9663
! 	}
Karsten Hopp ef9663
      }
Karsten Hopp ef9663
  }
Karsten Hopp ef9663
  
Karsten Hopp ef9663
*** ../vim-7.0.116/src/version.c	Tue Oct  3 16:30:40 2006
Karsten Hopp ef9663
--- src/version.c	Tue Oct  3 16:59:50 2006
Karsten Hopp ef9663
***************
Karsten Hopp ef9663
*** 668,669 ****
Karsten Hopp ef9663
--- 668,671 ----
Karsten Hopp ef9663
  {   /* Add new patch number below this line */
Karsten Hopp ef9663
+ /**/
Karsten Hopp ef9663
+     117,
Karsten Hopp ef9663
  /**/
Karsten Hopp ef9663
Karsten Hopp ef9663
-- 
Karsten Hopp ef9663
For humans, honesty is a matter of degree.  Engineers are always honest in
Karsten Hopp ef9663
matters of technology and human relationships.  That's why it's a good idea
Karsten Hopp ef9663
to keep engineers away from customers, romantic interests, and other people
Karsten Hopp ef9663
who can't handle the truth.
Karsten Hopp ef9663
				(Scott Adams - The Dilbert principle)
Karsten Hopp ef9663
Karsten Hopp ef9663
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ef9663
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ef9663
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp ef9663
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///