To: vim_dev@googlegroups.com Subject: Patch 8.1.2075 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2075 Problem: Get many log messages when waiting for a typed character. Solution: Do not repeat the repeated messages when nothing happens. Files: src/globals.h, src/channel.c, src/main.c *** ../vim-8.1.2074/src/globals.h 2019-09-19 23:05:56.471034946 +0200 --- src/globals.h 2019-09-25 21:31:57.913975534 +0200 *************** *** 1728,1730 **** --- 1728,1736 ---- EXTERN int ctrl_break_was_pressed INIT(= FALSE); EXTERN HINSTANCE g_hinst INIT(= NULL); #endif + + #if defined(FEAT_JOB_CHANNEL) + EXTERN int did_repeated_msg INIT(= 0); + # define REPEATED_MSG_LOOKING 1 + # define REPEATED_MSG_SAFESTATE 2 + #endif *** ../vim-8.1.2074/src/channel.c 2019-09-21 23:09:00.971830733 +0200 --- src/channel.c 2019-09-25 21:31:33.854062450 +0200 *************** *** 194,201 **** } } - static int did_log_msg = TRUE; - #ifndef PROTO // prototype is in proto.h void ch_log(channel_T *ch, const char *fmt, ...) --- 194,199 ---- *************** *** 210,216 **** va_end(ap); fputc('\n', log_fd); fflush(log_fd); ! did_log_msg = TRUE; } } #endif --- 208,214 ---- va_end(ap); fputc('\n', log_fd); fflush(log_fd); ! did_repeated_msg = 0; } } #endif *************** *** 235,241 **** va_end(ap); fputc('\n', log_fd); fflush(log_fd); ! did_log_msg = TRUE; } } --- 233,239 ---- va_end(ap); fputc('\n', log_fd); fflush(log_fd); ! did_repeated_msg = 0; } } *************** *** 3918,3924 **** vim_ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd); fprintf(log_fd, "'\n"); fflush(log_fd); ! did_log_msg = TRUE; } for (;;) --- 3916,3922 ---- vim_ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd); fprintf(log_fd, "'\n"); fflush(log_fd); ! did_repeated_msg = 0; } for (;;) *************** *** 4432,4441 **** /* Only do this message when another message was given, otherwise we get * lots of them. */ ! if (did_log_msg) { ch_log(NULL, "looking for messages on channels"); ! did_log_msg = FALSE; } while (channel != NULL) { --- 4430,4440 ---- /* Only do this message when another message was given, otherwise we get * lots of them. */ ! if ((did_repeated_msg & REPEATED_MSG_LOOKING) == 0) { ch_log(NULL, "looking for messages on channels"); ! // now we should also give the message for SafeState ! did_repeated_msg = REPEATED_MSG_LOOKING; } while (channel != NULL) { *** ../vim-8.1.2074/src/main.c 2019-09-21 23:09:00.975830710 +0200 --- src/main.c 2019-09-25 21:33:45.217575083 +0200 *************** *** 1122,1128 **** if (was_safe) { #ifdef FEAT_JOB_CHANNEL ! ch_log(NULL, "SafeState: back to waiting, triggering SafeStateAgain"); #endif apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf); } --- 1122,1137 ---- if (was_safe) { #ifdef FEAT_JOB_CHANNEL ! // Only do this message when another message was given, otherwise we ! // get lots of them. ! if ((did_repeated_msg & REPEATED_MSG_SAFESTATE) == 0) ! { ! int did = did_repeated_msg; ! ! ch_log(NULL, ! "SafeState: back to waiting, triggering SafeStateAgain"); ! did_repeated_msg = did | REPEATED_MSG_SAFESTATE; ! } #endif apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf); } *** ../vim-8.1.2074/src/version.c 2019-09-25 21:16:11.773957877 +0200 --- src/version.c 2019-09-25 21:34:12.213471378 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2075, /**/ -- Veni, Vidi, Video -- I came, I saw, I taped what I saw. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///