comparison src/channel.c @ 18160:770987511384 v8.1.2075

patch 8.1.2075: get many log messages when waiting for a typed character Commit: https://github.com/vim/vim/commit/101e99207f813ca48a4c0787eed9eb8bf67fba5a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 25 21:43:11 2019 +0200 patch 8.1.2075: get many log messages when waiting for a typed character Problem: Get many log messages when waiting for a typed character. Solution: Do not repeat the repeated messages when nothing happens.
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Sep 2019 21:45:03 +0200
parents 59bc3cd42cf5
children 4ac8161e92e0
comparison
equal deleted inserted replaced
18159:edb8178cb67f 18160:770987511384
192 else 192 else
193 fprintf(log_fd, "%s: ", what); 193 fprintf(log_fd, "%s: ", what);
194 } 194 }
195 } 195 }
196 196
197 static int did_log_msg = TRUE;
198
199 #ifndef PROTO // prototype is in proto.h 197 #ifndef PROTO // prototype is in proto.h
200 void 198 void
201 ch_log(channel_T *ch, const char *fmt, ...) 199 ch_log(channel_T *ch, const char *fmt, ...)
202 { 200 {
203 if (log_fd != NULL) 201 if (log_fd != NULL)
208 va_start(ap, fmt); 206 va_start(ap, fmt);
209 vfprintf(log_fd, fmt, ap); 207 vfprintf(log_fd, fmt, ap);
210 va_end(ap); 208 va_end(ap);
211 fputc('\n', log_fd); 209 fputc('\n', log_fd);
212 fflush(log_fd); 210 fflush(log_fd);
213 did_log_msg = TRUE; 211 did_repeated_msg = 0;
214 } 212 }
215 } 213 }
216 #endif 214 #endif
217 215
218 static void 216 static void
233 va_start(ap, fmt); 231 va_start(ap, fmt);
234 vfprintf(log_fd, fmt, ap); 232 vfprintf(log_fd, fmt, ap);
235 va_end(ap); 233 va_end(ap);
236 fputc('\n', log_fd); 234 fputc('\n', log_fd);
237 fflush(log_fd); 235 fflush(log_fd);
238 did_log_msg = TRUE; 236 did_repeated_msg = 0;
239 } 237 }
240 } 238 }
241 239
242 #ifdef MSWIN 240 #ifdef MSWIN
243 # undef PERROR 241 # undef PERROR
3916 ch_log_lead("SEND ", channel, part); 3914 ch_log_lead("SEND ", channel, part);
3917 fprintf(log_fd, "'"); 3915 fprintf(log_fd, "'");
3918 vim_ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd); 3916 vim_ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd);
3919 fprintf(log_fd, "'\n"); 3917 fprintf(log_fd, "'\n");
3920 fflush(log_fd); 3918 fflush(log_fd);
3921 did_log_msg = TRUE; 3919 did_repeated_msg = 0;
3922 } 3920 }
3923 3921
3924 for (;;) 3922 for (;;)
3925 { 3923 {
3926 writeq_T *wq = &ch_part->ch_writeque; 3924 writeq_T *wq = &ch_part->ch_writeque;
4430 4428
4431 ++safe_to_invoke_callback; 4429 ++safe_to_invoke_callback;
4432 4430
4433 /* Only do this message when another message was given, otherwise we get 4431 /* Only do this message when another message was given, otherwise we get
4434 * lots of them. */ 4432 * lots of them. */
4435 if (did_log_msg) 4433 if ((did_repeated_msg & REPEATED_MSG_LOOKING) == 0)
4436 { 4434 {
4437 ch_log(NULL, "looking for messages on channels"); 4435 ch_log(NULL, "looking for messages on channels");
4438 did_log_msg = FALSE; 4436 // now we should also give the message for SafeState
4437 did_repeated_msg = REPEATED_MSG_LOOKING;
4439 } 4438 }
4440 while (channel != NULL) 4439 while (channel != NULL)
4441 { 4440 {
4442 if (channel_can_close(channel)) 4441 if (channel_can_close(channel))
4443 { 4442 {