home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.0 / 7.0.117 < prev    next >
Encoding:
Internet Message Format  |  2006-10-02  |  4.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.0.117
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.0.117
  11. Problem:    Using "extend" on a syntax item inside a region with "keepend", an
  12.         intermediate item may be truncated.
  13.         When applying the "keepend" and there is an offset to the end
  14.         pattern the highlighting of a contained item isn't adjusted.
  15. Solution:   Use the seen_keepend flag to remember when to apply the "keepend"
  16.         flag.  Adjust the keepend highlighting properly. (Ilya Bobir)
  17. Files:        src/syntax.c
  18.  
  19.  
  20. *** ../vim-7.0.116/src/syntax.c    Thu Apr 27 01:58:59 2006
  21. --- src/syntax.c    Tue Oct  3 17:00:44 2006
  22. ***************
  23. *** 977,982 ****
  24. --- 977,983 ----
  25.   {
  26.       stateitem_T    *cur_si;
  27.       int        i;
  28. +     int        seen_keepend;
  29.   
  30.       if (startofline)
  31.       {
  32. ***************
  33. *** 1002,1008 ****
  34.       /*
  35.        * Need to update the end of a start/skip/end that continues from the
  36.        * previous line.  And regions that have "keepend", because they may
  37. !      * influence contained items.
  38.        * Then check for items ending in column 0.
  39.        */
  40.       i = current_state.ga_len - 1;
  41. --- 1003,1012 ----
  42.       /*
  43.        * Need to update the end of a start/skip/end that continues from the
  44.        * previous line.  And regions that have "keepend", because they may
  45. !      * influence contained items.  If we've just removed "extend"
  46. !      * (startofline == 0) then we should update ends of normal regions
  47. !      * contained inside "keepend" because "extend" could have extended
  48. !      * these "keepend" regions as well as contained normal regions.
  49.        * Then check for items ending in column 0.
  50.        */
  51.       i = current_state.ga_len - 1;
  52. ***************
  53. *** 1010,1019 ****
  54. --- 1014,1026 ----
  55.       for ( ; i > keepend_level; --i)
  56.           if (CUR_STATE(i).si_flags & HL_EXTEND)
  57.           break;
  58. +     seen_keepend = FALSE;
  59.       for ( ; i < current_state.ga_len; ++i)
  60.       {
  61.       cur_si = &CUR_STATE(i);
  62.       if ((cur_si->si_flags & HL_KEEPEND)
  63. +                 || (seen_keepend && !startofline)
  64.                   || (i == current_state.ga_len - 1 && startofline))
  65.       {
  66.           cur_si->si_h_startpos.col = 0;    /* start highl. in col 0 */
  67. ***************
  68. *** 1021,1026 ****
  69. --- 1028,1036 ----
  70.   
  71.           if (!(cur_si->si_flags & HL_MATCHCONT))
  72.           update_si_end(cur_si, (int)current_col, !startofline);
  73. +         if (!startofline && (cur_si->si_flags & HL_KEEPEND))
  74. +         seen_keepend = TRUE;
  75.       }
  76.       }
  77.       check_keepend();
  78. ***************
  79. *** 2564,2569 ****
  80. --- 2574,2580 ----
  81.   {
  82.       int        i;
  83.       lpos_T    maxpos;
  84. +     lpos_T    maxpos_h;
  85.       stateitem_T    *sip;
  86.   
  87.       /*
  88. ***************
  89. *** 2583,2605 ****
  90.           break;
  91.   
  92.       maxpos.lnum = 0;
  93.       for ( ; i < current_state.ga_len; ++i)
  94.       {
  95.       sip = &CUR_STATE(i);
  96.       if (maxpos.lnum != 0)
  97.       {
  98.           limit_pos_zero(&sip->si_m_endpos, &maxpos);
  99. !         limit_pos_zero(&sip->si_h_endpos, &maxpos);
  100.           limit_pos_zero(&sip->si_eoe_pos, &maxpos);
  101.           sip->si_ends = TRUE;
  102.       }
  103. !     if (sip->si_ends
  104. !         && (sip->si_flags & HL_KEEPEND)
  105. !         && (maxpos.lnum == 0
  106.               || maxpos.lnum > sip->si_m_endpos.lnum
  107.               || (maxpos.lnum == sip->si_m_endpos.lnum
  108. !             && maxpos.col > sip->si_m_endpos.col)))
  109. !         maxpos = sip->si_m_endpos;
  110.       }
  111.   }
  112.   
  113. --- 2594,2623 ----
  114.           break;
  115.   
  116.       maxpos.lnum = 0;
  117. +     maxpos_h.lnum = 0;
  118.       for ( ; i < current_state.ga_len; ++i)
  119.       {
  120.       sip = &CUR_STATE(i);
  121.       if (maxpos.lnum != 0)
  122.       {
  123.           limit_pos_zero(&sip->si_m_endpos, &maxpos);
  124. !         limit_pos_zero(&sip->si_h_endpos, &maxpos_h);
  125.           limit_pos_zero(&sip->si_eoe_pos, &maxpos);
  126.           sip->si_ends = TRUE;
  127.       }
  128. !     if (sip->si_ends && (sip->si_flags & HL_KEEPEND))
  129. !     {
  130. !         if (maxpos.lnum == 0
  131.               || maxpos.lnum > sip->si_m_endpos.lnum
  132.               || (maxpos.lnum == sip->si_m_endpos.lnum
  133. !             && maxpos.col > sip->si_m_endpos.col))
  134. !         maxpos = sip->si_m_endpos;
  135. !         if (maxpos_h.lnum == 0
  136. !             || maxpos_h.lnum > sip->si_h_endpos.lnum
  137. !             || (maxpos_h.lnum == sip->si_h_endpos.lnum
  138. !             && maxpos_h.col > sip->si_h_endpos.col))
  139. !         maxpos_h = sip->si_h_endpos;
  140. !     }
  141.       }
  142.   }
  143.   
  144. *** ../vim-7.0.116/src/version.c    Tue Oct  3 16:30:40 2006
  145. --- src/version.c    Tue Oct  3 16:59:50 2006
  146. ***************
  147. *** 668,669 ****
  148. --- 668,671 ----
  149.   {   /* Add new patch number below this line */
  150. + /**/
  151. +     117,
  152.   /**/
  153.  
  154. -- 
  155. For humans, honesty is a matter of degree.  Engineers are always honest in
  156. matters of technology and human relationships.  That's why it's a good idea
  157. to keep engineers away from customers, romantic interests, and other people
  158. who can't handle the truth.
  159.                 (Scott Adams - The Dilbert principle)
  160.  
  161.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  162. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  163. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  164.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  165.