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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909251943.x8PJhcOM022781%40masaka.moolenaar.net.

Raspunde prin e-mail lui