1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
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)
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
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 */
32 static struct msg_hist *last_msg_hist = NULL;
33 static int msg_hist_len = 0;
35 + static FILE *verbose_fd = NULL;
36 + static int verbose_did_open = FALSE;
39 * When writing messages to the screen, there are many different situations.
40 * A number of variables is used to remember the current state:
44 if (has_mbyte && !IS_SPECIAL(c))
46 ! int len = (*mb_ptr2len)(str);
48 /* For multi-byte characters check for an illegal byte. */
49 if (has_mbyte && MB_BYTE2LEN(*str) > len)
52 if (has_mbyte && !IS_SPECIAL(c))
54 ! int len = (*mb_ptr2len)(str);
56 /* For multi-byte characters check for an illegal byte. */
57 if (has_mbyte && MB_BYTE2LEN(*str) > len)
63 ! /* Since 'special' is TRUE the multi-byte character 'c' will be
64 ! * processed by get_special_key_name() */
65 ! c = (*mb_ptr2char)(str);
74 ! /* Since 'special' is TRUE the multi-byte character 'c' will be
75 ! * processed by get_special_key_name() */
76 ! c = (*mb_ptr2char)(str);
87 ! * If 'verbosefile' is set write message in that file.
88 ! * Must come before the rest because of updating "msg_col".
90 ! if (*p_vfile != NUL)
91 ! verbose_write(s, maxlen);
99 ! /* If 'verbosefile' is set prepare for writing in that file. */
100 ! if (*p_vfile != NUL && verbose_fd == NULL)
107 write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE);
108 else if (redir_vname)
109 var_redir_str((char_u *)" ", -1);
112 fputs(" ", redir_fd);
117 write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE);
118 else if (redir_vname)
119 var_redir_str((char_u *)" ", -1);
122 + if (redir_fd != NULL)
123 fputs(" ", redir_fd);
124 + if (verbose_fd != NULL)
125 + fputs(" ", verbose_fd);
131 var_redir_str(s, maxlen);
134 ! /* Adjust the current column */
135 while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
138 ! if (!redir_reg && !redir_vname && redir_fd != NULL)
140 ! putc(*s, redir_fd);
141 if (*s == '\r' || *s == '\n')
145 var_redir_str(s, maxlen);
148 ! /* Write and adjust the current column. */
149 while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
152 ! if (!redir_reg && !redir_vname)
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')
166 ! return redir_fd != NULL
168 || redir_reg || redir_vname
174 ! return redir_fd != NULL || *p_vfile != NUL
176 || redir_reg || redir_vname
180 cmdline_row = msg_row;
183 - static FILE *verbose_fd = NULL;
184 - static int verbose_did_open = FALSE;
187 * Called when 'verbosefile' is set: stop writing to the file.
195 - * Write a string to 'verbosefile'.
196 - * When "maxlen" is -1 write the whole string, otherwise up to "maxlen" bytes.
199 - verbose_write(str, maxlen)
204 - static int cur_col = 0;
206 - /* Open the file when called the first time. */
207 - if (verbose_fd == NULL)
210 - if (verbose_fd != NULL)
212 - /* If the string doesn't start with CR or NL, go to msg_col */
213 - if (*s != '\n' && *s != '\r')
215 - while (cur_col < msg_col)
217 - fputs(" ", verbose_fd);
222 - /* Adjust the current column */
223 - while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
225 - putc(*s, verbose_fd);
226 - if (*s == '\r' || *s == '\n')
228 - else if (*s == '\t')
229 - cur_col += (8 - cur_col % 8);
238 * Give a warning message (for searching).
239 * Use 'w' highlighting and may repeat the message after redrawing
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
247 { /* Add new patch number below this line */
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)
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 ///