]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.028
- new
[packages/vim.git] / 7.3.028
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
50             sp_prev = NULL;
51             for (sp = first_sign; sp != NULL; sp = sp->sn_next)
52             {
53 ***************
54 *** 6666,6706 ****
55                 /* ":sign define {name} ...": define a sign */
56                 if (sp == NULL)
57                 {
58                     /* Allocate a new sign. */
59                     sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
60                     if (sp == NULL)
61                         return;
62   
63 !                   /* If the name is a number use that for the typenr,
64 !                    * otherwise use a negative number. */
65 !                   if (VIM_ISDIGIT(*arg))
66 !                       sp->sn_typenr = atoi((char *)arg);
67 !                   else
68                     {
69 !                       sign_T  *lp;
70 !                       int     start = last_sign_typenr;
71
72 !                       for (lp = first_sign; lp != NULL; lp = lp->sn_next)
73                         {
74 !                           if (lp->sn_typenr == -last_sign_typenr)
75                             {
76 !                               --last_sign_typenr;
77 !                               if (last_sign_typenr == 0)
78 !                                   last_sign_typenr = MAX_TYPENR;
79 !                               if (last_sign_typenr == start)
80 !                               {
81 !                                   vim_free(sp);
82 !                                   EMSG(_("E612: Too many signs defined"));
83 !                                   return;
84 !                               }
85 !                               lp = first_sign;
86 !                               continue;
87                             }
88                         }
89   
90 !                       sp->sn_typenr = -last_sign_typenr;
91 !                       if (--last_sign_typenr == 0)
92 !                           last_sign_typenr = MAX_TYPENR; /* wrap around */
93                     }
94   
95                     /* add the new sign to the list of signs */
96 --- 6671,6715 ----
97                 /* ":sign define {name} ...": define a sign */
98                 if (sp == NULL)
99                 {
100 +                   sign_T      *lp;
101 +                   int         start = next_sign_typenr;
102
103                     /* Allocate a new sign. */
104                     sp = (sign_T *)alloc_clear((unsigned)sizeof(sign_T));
105                     if (sp == NULL)
106                         return;
107   
108 !                   /* Check that next_sign_typenr is not already being used.
109 !                    * This only happens after wrapping around.  Hopefully
110 !                    * another one got deleted and we can use its number. */
111 !                   for (lp = first_sign; lp != NULL; )
112                     {
113 !                       if (lp->sn_typenr == next_sign_typenr)
114                         {
115 !                           ++next_sign_typenr;
116 !                           if (next_sign_typenr == MAX_TYPENR)
117 !                               next_sign_typenr = 1;
118 !                           if (next_sign_typenr == start)
119                             {
120 !                               vim_free(sp);
121 !                               EMSG(_("E612: Too many signs defined"));
122 !                               return;
123                             }
124 +                           lp = first_sign;  /* start all over */
125 +                           continue;
126                         }
127 +                       lp = lp->sn_next;
128 +                   }
129
130 +                   sp->sn_typenr = next_sign_typenr;
131 +                   if (++next_sign_typenr == MAX_TYPENR)
132 +                       next_sign_typenr = 1; /* wrap around */
133   
134 !                   sp->sn_name = vim_strsave(arg);
135 !                   if (sp->sn_name == NULL)  /* out of memory */
136 !                   {
137 !                       vim_free(sp);
138 !                       return;
139                     }
140   
141                     /* add the new sign to the list of signs */
142 ***************
143 *** 6708,6714 ****
144                         first_sign = sp;
145                     else
146                         sp_prev->sn_next = sp;
147 -                   sp->sn_name = vim_strnsave(arg, (int)(p - arg));
148                 }
149   
150                 /* set values for a defined sign. */
151 --- 6717,6722 ----
152 ***************
153 *** 6886,6891 ****
154 --- 6894,6901 ----
155                 arg = skiptowhite(arg);
156                 if (*arg != NUL)
157                     *arg++ = NUL;
158 +               while (sign_name[0] == '0' && sign_name[1] != NUL)
159 +                   ++sign_name;
160             }
161             else if (STRNCMP(arg, "file=", 5) == 0)
162             {
163 *** ../vim-7.3.027/src/version.c        2010-10-13 20:37:37.000000000 +0200
164 --- src/version.c       2010-10-14 20:50:54.000000000 +0200
165 ***************
166 *** 716,717 ****
167 --- 716,719 ----
168   {   /* Add new patch number below this line */
169 + /**/
170 +     28,
171   /**/
172
173 -- 
174 This is an airconditioned room, do not open Windows.
175
176  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
177 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
178 \\\        download, build and distribute -- http://www.A-A-P.org        ///
179  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.046378 seconds and 3 git commands to generate.