]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.308
- new
[packages/vim.git] / 7.3.308
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.308
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.308
11 Problem:    Writing to 'verbosefile' has problems, e.g. for :highlight.
12 Solution:   Do not use a separate verbose_write() function but write with the
13             same code that does redirecting. (Yasuhiro Matsumoto)
14 Files:      src/message.c
15
16
17 *** ../vim-7.3.307/src/message.c        2011-08-17 20:33:18.000000000 +0200
18 --- src/message.c       2011-09-14 15:32:57.000000000 +0200
19 ***************
20 *** 39,45 ****
21   static void msg_screen_putchar __ARGS((int c, int attr));
22   static int  msg_check_screen __ARGS((void));
23   static void redir_write __ARGS((char_u *s, int maxlen));
24 - static void verbose_write __ARGS((char_u *s, int maxlen));
25   #ifdef FEAT_CON_DIALOG
26   static char_u *msg_show_console_dialog __ARGS((char_u *message, char_u *buttons, int dfltbutton));
27   static int    confirm_msg_used = FALSE;       /* displaying confirm_msg */
28 --- 39,44 ----
29 ***************
30 *** 58,63 ****
31 --- 57,65 ----
32   static struct msg_hist *last_msg_hist = NULL;
33   static int msg_hist_len = 0;
34   
35 + static FILE *verbose_fd = NULL;
36 + static int  verbose_did_open = FALSE;
37
38   /*
39    * When writing messages to the screen, there are many different situations.
40    * A number of variables is used to remember the current state:
41 ***************
42 *** 1551,1557 ****
43   #ifdef FEAT_MBYTE
44       if (has_mbyte && !IS_SPECIAL(c))
45       {
46 !         int len = (*mb_ptr2len)(str);
47   
48         /* For multi-byte characters check for an illegal byte. */
49         if (has_mbyte && MB_BYTE2LEN(*str) > len)
50 --- 1553,1559 ----
51   #ifdef FEAT_MBYTE
52       if (has_mbyte && !IS_SPECIAL(c))
53       {
54 !       int len = (*mb_ptr2len)(str);
55   
56         /* For multi-byte characters check for an illegal byte. */
57         if (has_mbyte && MB_BYTE2LEN(*str) > len)
58 ***************
59 *** 1560,1569 ****
60             *sp = str + 1;
61             return buf;
62         }
63 !         /* Since 'special' is TRUE the multi-byte character 'c' will be
64 !          * processed by get_special_key_name() */
65 !         c = (*mb_ptr2char)(str);
66 !         *sp = str + len;
67       }
68       else
69   #endif
70 --- 1562,1571 ----
71             *sp = str + 1;
72             return buf;
73         }
74 !       /* Since 'special' is TRUE the multi-byte character 'c' will be
75 !        * processed by get_special_key_name() */
76 !       c = (*mb_ptr2char)(str);
77 !       *sp = str + len;
78       }
79       else
80   #endif
81 ***************
82 *** 3065,3076 ****
83       if (redir_off)
84         return;
85   
86 !     /*
87 !      * If 'verbosefile' is set write message in that file.
88 !      * Must come before the rest because of updating "msg_col".
89 !      */
90 !     if (*p_vfile != NUL)
91 !       verbose_write(s, maxlen);
92   
93       if (redirecting())
94       {
95 --- 3067,3075 ----
96       if (redir_off)
97         return;
98   
99 !     /* If 'verbosefile' is set prepare for writing in that file. */
100 !     if (*p_vfile != NUL && verbose_fd == NULL)
101 !       verbose_open();
102   
103       if (redirecting())
104       {
105 ***************
106 *** 3084,3092 ****
107                     write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE);
108                 else if (redir_vname)
109                     var_redir_str((char_u *)" ", -1);
110 !               else if (redir_fd)
111   #endif
112                     fputs(" ", redir_fd);
113                 ++cur_col;
114             }
115         }
116 --- 3083,3094 ----
117                     write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE);
118                 else if (redir_vname)
119                     var_redir_str((char_u *)" ", -1);
120 !               else
121   #endif
122 +                   if (redir_fd != NULL)
123                     fputs(" ", redir_fd);
124 +               if (verbose_fd != NULL)
125 +                   fputs(" ", verbose_fd);
126                 ++cur_col;
127             }
128         }
129 ***************
130 *** 3098,3110 ****
131             var_redir_str(s, maxlen);
132   #endif
133   
134 !       /* Adjust the current column */
135         while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
136         {
137   #ifdef FEAT_EVAL
138 !           if (!redir_reg && !redir_vname && redir_fd != NULL)
139   #endif
140 !               putc(*s, redir_fd);
141             if (*s == '\r' || *s == '\n')
142                 cur_col = 0;
143             else if (*s == '\t')
144 --- 3100,3115 ----
145             var_redir_str(s, maxlen);
146   #endif
147   
148 !       /* Write and adjust the current column. */
149         while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
150         {
151   #ifdef FEAT_EVAL
152 !           if (!redir_reg && !redir_vname)
153   #endif
154 !               if (redir_fd != NULL)
155 !                   putc(*s, redir_fd);
156 !           if (verbose_fd != NULL)
157 !               putc(*s, verbose_fd);
158             if (*s == '\r' || *s == '\n')
159                 cur_col = 0;
160             else if (*s == '\t')
161 ***************
162 *** 3122,3128 ****
163       int
164   redirecting()
165   {
166 !     return redir_fd != NULL
167   #ifdef FEAT_EVAL
168                           || redir_reg || redir_vname
169   #endif
170 --- 3127,3133 ----
171       int
172   redirecting()
173   {
174 !     return redir_fd != NULL || *p_vfile != NUL
175   #ifdef FEAT_EVAL
176                           || redir_reg || redir_vname
177   #endif
178 ***************
179 *** 3180,3188 ****
180         cmdline_row = msg_row;
181   }
182   
183 - static FILE *verbose_fd = NULL;
184 - static int  verbose_did_open = FALSE;
185
186   /*
187    * Called when 'verbosefile' is set: stop writing to the file.
188    */
189 --- 3185,3190 ----
190 ***************
191 *** 3220,3268 ****
192   }
193   
194   /*
195 -  * Write a string to 'verbosefile'.
196 -  * When "maxlen" is -1 write the whole string, otherwise up to "maxlen" bytes.
197 -  */
198 -     static void
199 - verbose_write(str, maxlen)
200 -     char_u    *str;
201 -     int               maxlen;
202 - {
203 -     char_u    *s = str;
204 -     static int        cur_col = 0;
205
206 -     /* Open the file when called the first time. */
207 -     if (verbose_fd == NULL)
208 -       verbose_open();
209
210 -     if (verbose_fd != NULL)
211 -     {
212 -       /* If the string doesn't start with CR or NL, go to msg_col */
213 -       if (*s != '\n' && *s != '\r')
214 -       {
215 -           while (cur_col < msg_col)
216 -           {
217 -               fputs(" ", verbose_fd);
218 -               ++cur_col;
219 -           }
220 -       }
221
222 -       /* Adjust the current column */
223 -       while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
224 -       {
225 -           putc(*s, verbose_fd);
226 -           if (*s == '\r' || *s == '\n')
227 -               cur_col = 0;
228 -           else if (*s == '\t')
229 -               cur_col += (8 - cur_col % 8);
230 -           else
231 -               ++cur_col;
232 -           ++s;
233 -       }
234 -     }
235 - }
236
237 - /*
238    * Give a warning message (for searching).
239    * Use 'w' highlighting and may repeat the message after redrawing
240    */
241 --- 3222,3227 ----
242 *** ../vim-7.3.307/src/version.c        2011-09-14 15:01:54.000000000 +0200
243 --- src/version.c       2011-09-14 15:38:31.000000000 +0200
244 ***************
245 *** 711,712 ****
246 --- 711,714 ----
247   {   /* Add new patch number below this line */
248 + /**/
249 +     308,
250   /**/
251
252 -- 
253 The average life of an organization chart is six months.  You can safely
254 ignore any order from your boss that would take six months to complete.
255                                 (Scott Adams - The Dilbert principle)
256
257  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
258 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
259 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
260  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.087947 seconds and 3 git commands to generate.