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.3 / 7.3.028 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  4.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.3.028
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.028 (after 7.3.024)
  11. Problem:    Signs don't show up. (Charles Campbell)
  12. Solution:   Don't use negative numbers.  Also assign a number to signs that
  13.         have a name of all digits to avoid using a sign number twice.
  14. Files:        src/ex_cmds.c
  15.  
  16.  
  17. *** ../vim-7.3.027/src/ex_cmds.c    2010-10-13 16:44:17.000000000 +0200
  18. --- src/ex_cmds.c    2010-10-14 20:59:04.000000000 +0200
  19. ***************
  20. *** 6569,6575 ****
  21.   };
  22.   
  23.   static sign_T    *first_sign = NULL;
  24. ! static int    last_sign_typenr = MAX_TYPENR;    /* is decremented */
  25.   
  26.   static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
  27.   static void sign_list_defined __ARGS((sign_T *sp));
  28. --- 6569,6575 ----
  29.   };
  30.   
  31.   static sign_T    *first_sign = NULL;
  32. ! static int    next_sign_typenr = 1;
  33.   
  34.   static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
  35.   static void sign_list_defined __ARGS((sign_T *sp));
  36. ***************
  37. *** 6651,6659 ****
  38. --- 6651,6664 ----
  39.           EMSG(_("E156: Missing sign name"));
  40.       else
  41.       {
  42. +         /* Isolate the sign name.  If it's a number skip leading zeroes,
  43. +          * so that "099" and "99" are the same sign.  But keep "0". */
  44.           p = skiptowhite(arg);
  45.           if (*p != NUL)
  46.           *p++ = NUL;
  47. +         while (arg[0] == '0' && arg[1] != NUL)
  48. +         ++arg;
  49.           sp_prev = NULL;
  50.           for (sp = first_sign; sp != NULL; sp = sp->sn_next)
  51.           {
  52. ***************
  53. *** 6666,6706 ****
  54.           /* ":sign define {name} ...": define a sign */
  55.           if (sp == NULL)
  56.           {
  57.               /* Allocate a new sign. */
  58.               sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
  59.               if (sp == NULL)
  60.               return;
  61.   
  62. !             /* If the name is a number use that for the typenr,
  63. !              * otherwise use a negative number. */
  64. !             if (VIM_ISDIGIT(*arg))
  65. !             sp->sn_typenr = atoi((char *)arg);
  66. !             else
  67.               {
  68. !             sign_T    *lp;
  69. !             int    start = last_sign_typenr;
  70. !             for (lp = first_sign; lp != NULL; lp = lp->sn_next)
  71.               {
  72. !                 if (lp->sn_typenr == -last_sign_typenr)
  73.                   {
  74. !                 --last_sign_typenr;
  75. !                 if (last_sign_typenr == 0)
  76. !                     last_sign_typenr = MAX_TYPENR;
  77. !                 if (last_sign_typenr == start)
  78. !                 {
  79. !                     vim_free(sp);
  80. !                     EMSG(_("E612: Too many signs defined"));
  81. !                     return;
  82. !                 }
  83. !                 lp = first_sign;
  84. !                 continue;
  85.                   }
  86.               }
  87.   
  88. !             sp->sn_typenr = -last_sign_typenr;
  89. !             if (--last_sign_typenr == 0)
  90. !                 last_sign_typenr = MAX_TYPENR; /* wrap around */
  91.               }
  92.   
  93.               /* add the new sign to the list of signs */
  94. --- 6671,6715 ----
  95.           /* ":sign define {name} ...": define a sign */
  96.           if (sp == NULL)
  97.           {
  98. +             sign_T    *lp;
  99. +             int        start = next_sign_typenr;
  100.               /* Allocate a new sign. */
  101.               sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
  102.               if (sp == NULL)
  103.               return;
  104.   
  105. !             /* Check that next_sign_typenr is not already being used.
  106. !              * This only happens after wrapping around.  Hopefully
  107. !              * another one got deleted and we can use its number. */
  108. !             for (lp = first_sign; lp != NULL; )
  109.               {
  110. !             if (lp->sn_typenr == next_sign_typenr)
  111.               {
  112. !                 ++next_sign_typenr;
  113. !                 if (next_sign_typenr == MAX_TYPENR)
  114. !                 next_sign_typenr = 1;
  115. !                 if (next_sign_typenr == start)
  116.                   {
  117. !                 vim_free(sp);
  118. !                 EMSG(_("E612: Too many signs defined"));
  119. !                 return;
  120.                   }
  121. +                 lp = first_sign;  /* start all over */
  122. +                 continue;
  123.               }
  124. +             lp = lp->sn_next;
  125. +             }
  126. +             sp->sn_typenr = next_sign_typenr;
  127. +             if (++next_sign_typenr == MAX_TYPENR)
  128. +             next_sign_typenr = 1; /* wrap around */
  129.   
  130. !             sp->sn_name = vim_strsave(arg);
  131. !             if (sp->sn_name == NULL)  /* out of memory */
  132. !             {
  133. !             vim_free(sp);
  134. !             return;
  135.               }
  136.   
  137.               /* add the new sign to the list of signs */
  138. ***************
  139. *** 6708,6714 ****
  140.               first_sign = sp;
  141.               else
  142.               sp_prev->sn_next = sp;
  143. -             sp->sn_name = vim_strnsave(arg, (int)(p - arg));
  144.           }
  145.   
  146.           /* set values for a defined sign. */
  147. --- 6717,6722 ----
  148. ***************
  149. *** 6886,6891 ****
  150. --- 6894,6901 ----
  151.           arg = skiptowhite(arg);
  152.           if (*arg != NUL)
  153.               *arg++ = NUL;
  154. +         while (sign_name[0] == '0' && sign_name[1] != NUL)
  155. +             ++sign_name;
  156.           }
  157.           else if (STRNCMP(arg, "file=", 5) == 0)
  158.           {
  159. *** ../vim-7.3.027/src/version.c    2010-10-13 20:37:37.000000000 +0200
  160. --- src/version.c    2010-10-14 20:50:54.000000000 +0200
  161. ***************
  162. *** 716,717 ****
  163. --- 716,719 ----
  164.   {   /* Add new patch number below this line */
  165. + /**/
  166. +     28,
  167.   /**/
  168.  
  169. -- 
  170. This is an airconditioned room, do not open Windows.
  171.  
  172.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  173. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  174. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  175.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  176.