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 / 6.0.044 < prev    next >
Encoding:
Internet Message Format  |  2001-10-30  |  6.1 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.044
  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 6.0.044
  11. Problem:    Using a "containedin" list for a syntax item doesn't work for an
  12.         item that doesn't have a "contains" argument.  Also, "containedin"
  13.         doesn't ignore a transparent item. (Timo Frenay)
  14. Solution:   When there is a "containedin" argument somewhere, always check for
  15.         contained items.  Don't check for the transparent item but the
  16.         item it's contained in.
  17. Files:        src/structs.h, src/syntax.c
  18.  
  19.  
  20. *** ../vim60.43/src/structs.h    Sun Oct 28 21:15:32 2001
  21. --- src/structs.h    Wed Oct 31 10:34:45 2001
  22. ***************
  23. *** 1018,1023 ****
  24. --- 1018,1025 ----
  25.       int        b_syn_ic;        /* ignore case for :syn cmds */
  26.       garray_T    b_syn_patterns;        /* table for syntax patterns */
  27.       garray_T    b_syn_clusters;        /* table for syntax clusters */
  28. +     int        b_syn_containedin;    /* TRUE when there is an item with a
  29. +                        "containedin" argument */
  30.       int        b_syn_sync_flags;    /* flags about how to sync */
  31.       short    b_syn_sync_id;        /* group to sync on */
  32.       long    b_syn_sync_minlines;    /* minimal sync lines offset */
  33. *** ../vim60.43/src/syntax.c    Mon Oct 22 18:52:01 2001
  34. --- src/syntax.c    Wed Oct 31 11:11:24 2001
  35. ***************
  36. *** 174,179 ****
  37. --- 174,180 ----
  38.   #define HL_FOLD        0x2000    /* define fold */
  39.   #define HL_EXTEND    0x4000    /* ignore a keepend */
  40.   #define HL_MATCHCONT    0x8000    /* match continued from previous line */
  41. + #define HL_TRANS_CONT    0x10000 /* transparent item without contains arg */
  42.   
  43.   #define SYN_ITEMS(buf)    ((synpat_T *)((buf)->b_syn_patterns.ga_data))
  44.   
  45. ***************
  46. *** 1772,1784 ****
  47.        * 1. Check for a current state.
  48.        *    Only when there is no current state, or if the current state may
  49.        *    contain other things, we need to check for keywords and patterns.
  50.        */
  51.       if (current_state.ga_len)
  52.           cur_si = &CUR_STATE(current_state.ga_len - 1);
  53.       else
  54.           cur_si = NULL;
  55.   
  56. !     if (cur_si == NULL || cur_si->si_cont_list != NULL)
  57.       {
  58.           /*
  59.            * 2. Check for keywords, if on a keyword char after a non-keyword
  60. --- 1773,1788 ----
  61.        * 1. Check for a current state.
  62.        *    Only when there is no current state, or if the current state may
  63.        *    contain other things, we need to check for keywords and patterns.
  64. +      *    Always need to check for contained items if some item has the
  65. +      *    "containedin" argument (takes extra time!).
  66.        */
  67.       if (current_state.ga_len)
  68.           cur_si = &CUR_STATE(current_state.ga_len - 1);
  69.       else
  70.           cur_si = NULL;
  71.   
  72. !     if (curbuf->b_syn_containedin || cur_si == NULL
  73. !                           || cur_si->si_cont_list != NULL)
  74.       {
  75.           /*
  76.            * 2. Check for keywords, if on a keyword char after a non-keyword
  77. ***************
  78. *** 2387,2393 ****
  79. --- 2391,2400 ----
  80.           sip->si_attr = CUR_STATE(idx - 1).si_attr;
  81.           sip->si_trans_id = CUR_STATE(idx - 1).si_trans_id;
  82.           if (sip->si_cont_list == NULL)
  83. +         {
  84. +         sip->si_flags |= HL_TRANS_CONT;
  85.           sip->si_cont_list = CUR_STATE(idx - 1).si_cont_list;
  86. +         }
  87.       }
  88.       }
  89.   }
  90. ***************
  91. *** 3001,3006 ****
  92. --- 3008,3014 ----
  93.       int i;
  94.   
  95.       curbuf->b_syn_ic = FALSE;        /* Use case, by default */
  96. +     curbuf->b_syn_containedin = FALSE;
  97.   
  98.       /* free the keywords */
  99.       free_keywtab(buf->b_keywtab);
  100. ***************
  101. *** 3884,3889 ****
  102. --- 3892,3899 ----
  103.       ktab->k_syn.inc_tag = current_syn_inc_tag;
  104.       ktab->flags = flags;
  105.       ktab->k_syn.cont_in_list = copy_id_list(cont_in_list);
  106. +     if (cont_in_list != NULL)
  107. +     curbuf->b_syn_containedin = TRUE;
  108.       ktab->next_list = copy_id_list(next_list);
  109.   
  110.       if (curbuf->b_syn_ic)
  111. ***************
  112. *** 4397,4402 ****
  113. --- 4407,4414 ----
  114.           SYN_ITEMS(curbuf)[idx].sp_sync_idx = sync_idx;
  115.           SYN_ITEMS(curbuf)[idx].sp_cont_list = cont_list;
  116.           SYN_ITEMS(curbuf)[idx].sp_syn.cont_in_list = cont_in_list;
  117. +         if (cont_in_list != NULL)
  118. +         curbuf->b_syn_containedin = TRUE;
  119.           SYN_ITEMS(curbuf)[idx].sp_next_list = next_list;
  120.           ++curbuf->b_syn_patterns.ga_len;
  121.           --curbuf->b_syn_patterns.ga_room;
  122. ***************
  123. *** 4637,4642 ****
  124. --- 4649,4656 ----
  125.               SYN_ITEMS(curbuf)[idx].sp_cont_list = cont_list;
  126.               SYN_ITEMS(curbuf)[idx].sp_syn.cont_in_list =
  127.                                    cont_in_list;
  128. +             if (cont_in_list != NULL)
  129. +                 curbuf->b_syn_containedin = TRUE;
  130.               SYN_ITEMS(curbuf)[idx].sp_next_list = next_list;
  131.               }
  132.               ++curbuf->b_syn_patterns.ga_len;
  133. ***************
  134. *** 5516,5527 ****
  135.       int        r;
  136.   
  137.       /* If spp has a "containedin" list and "cur_si" is in it, return TRUE. */
  138. !     if (cur_si != NULL
  139. !         && ssp->cont_in_list != NULL
  140. !         && in_id_list(NULL, ssp->cont_in_list,
  141.           &(SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_syn),
  142.             SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_flags & HL_CONTAINED))
  143.       return TRUE;
  144.   
  145.       /*
  146.        * If list is ID_LIST_ALL, we are in a transparent item that isn't
  147. --- 5530,5548 ----
  148.       int        r;
  149.   
  150.       /* If spp has a "containedin" list and "cur_si" is in it, return TRUE. */
  151. !     if (cur_si != NULL && ssp->cont_in_list != NULL)
  152. !     {
  153. !     /* Ignore transparent items without a contains argument. */
  154. !     while (cur_si->si_flags & HL_TRANS_CONT)
  155. !         --cur_si;
  156. !     if (in_id_list(NULL, ssp->cont_in_list,
  157.           &(SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_syn),
  158.             SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_flags & HL_CONTAINED))
  159.       return TRUE;
  160. +     }
  161. +     if (list == NULL)
  162. +     return FALSE;
  163.   
  164.       /*
  165.        * If list is ID_LIST_ALL, we are in a transparent item that isn't
  166. *** ../vim60.43/src/version.c    Wed Oct 31 10:12:03 2001
  167. --- src/version.c    Wed Oct 31 11:14:14 2001
  168. ***************
  169. *** 608,609 ****
  170. --- 608,611 ----
  171.   {   /* Add new patch number below this line */
  172. + /**/
  173. +     44,
  174.   /**/
  175.  
  176. -- 
  177. Citizens are not allowed to attend a movie house or theater nor ride in a
  178. public streetcar within at least four hours after eating garlic.
  179.         [real standing law in Indiana, United States of America]
  180.  
  181.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  182. (((   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   )))
  183.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  184.