comparison src/channel.c @ 29069:be6c32395444 v8.2.5056

patch 8.2.5056: the channel log only contains some of the raw terminal output Commit: https://github.com/vim/vim/commit/1d97db3d987c05af88c30ad20f537bcf3024f9c1 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 4 22:15:54 2022 +0100 patch 8.2.5056: the channel log only contains some of the raw terminal output Problem: The channel log only contains some of the raw terminal output. Solution: Add the "o" flag to log all terminal output. Use it for "--log".
author Bram Moolenaar <Bram@vim.org>
date Sat, 04 Jun 2022 23:30:03 +0200
parents d0241e74bfdb
children 755ab148288b
comparison
equal deleted inserted replaced
29068:912284d1b1e1 29069:be6c32395444
150 #endif 150 #endif
151 151
152 void 152 void
153 ch_logfile(char_u *fname, char_u *opt) 153 ch_logfile(char_u *fname, char_u *opt)
154 { 154 {
155 FILE *file = NULL; 155 FILE *file = NULL;
156 char *mode = "a";
156 157
157 if (log_fd != NULL) 158 if (log_fd != NULL)
158 { 159 {
159 if (*fname != NUL) 160 if (*fname != NUL)
160 ch_log(NULL, "closing this logfile, opening %s", fname); 161 ch_log(NULL, "closing this logfile, opening %s", fname);
161 else 162 else
162 ch_log(NULL, "closing logfile %s", log_name); 163 ch_log(NULL, "closing logfile %s", log_name);
163 fclose(log_fd); 164 fclose(log_fd);
164 } 165 }
165 166
167 // The "a" flag overrules the "w" flag.
168 if (vim_strchr(opt, 'a') == NULL && vim_strchr(opt, 'w') != NULL)
169 mode = "w";
170 ch_log_output = vim_strchr(opt, 'o') != NULL ? LOG_ALWAYS : FALSE;
171
166 if (*fname != NUL) 172 if (*fname != NUL)
167 { 173 {
168 file = fopen((char *)fname, *opt == 'w' ? "w" : "a"); 174 file = fopen((char *)fname, mode);
169 if (file == NULL) 175 if (file == NULL)
170 { 176 {
171 semsg(_(e_cant_open_file_str), fname); 177 semsg(_(e_cant_open_file_str), fname);
172 return; 178 return;
173 } 179 }