mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
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.
This commit is contained in:
@@ -194,8 +194,6 @@ ch_log_lead(const char *what, channel_T *ch, ch_part_T part)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int did_log_msg = TRUE;
|
|
||||||
|
|
||||||
#ifndef PROTO // prototype is in proto.h
|
#ifndef PROTO // prototype is in proto.h
|
||||||
void
|
void
|
||||||
ch_log(channel_T *ch, const char *fmt, ...)
|
ch_log(channel_T *ch, const char *fmt, ...)
|
||||||
@@ -210,7 +208,7 @@ ch_log(channel_T *ch, const char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
fputc('\n', log_fd);
|
fputc('\n', log_fd);
|
||||||
fflush(log_fd);
|
fflush(log_fd);
|
||||||
did_log_msg = TRUE;
|
did_repeated_msg = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -235,7 +233,7 @@ ch_error(channel_T *ch, const char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
fputc('\n', log_fd);
|
fputc('\n', log_fd);
|
||||||
fflush(log_fd);
|
fflush(log_fd);
|
||||||
did_log_msg = TRUE;
|
did_repeated_msg = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3918,7 +3916,7 @@ channel_send(
|
|||||||
vim_ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd);
|
vim_ignored = (int)fwrite(buf_arg, len_arg, 1, log_fd);
|
||||||
fprintf(log_fd, "'\n");
|
fprintf(log_fd, "'\n");
|
||||||
fflush(log_fd);
|
fflush(log_fd);
|
||||||
did_log_msg = TRUE;
|
did_repeated_msg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -4432,10 +4430,11 @@ channel_parse_messages(void)
|
|||||||
|
|
||||||
/* Only do this message when another message was given, otherwise we get
|
/* Only do this message when another message was given, otherwise we get
|
||||||
* lots of them. */
|
* lots of them. */
|
||||||
if (did_log_msg)
|
if ((did_repeated_msg & REPEATED_MSG_LOOKING) == 0)
|
||||||
{
|
{
|
||||||
ch_log(NULL, "looking for messages on channels");
|
ch_log(NULL, "looking for messages on channels");
|
||||||
did_log_msg = FALSE;
|
// now we should also give the message for SafeState
|
||||||
|
did_repeated_msg = REPEATED_MSG_LOOKING;
|
||||||
}
|
}
|
||||||
while (channel != NULL)
|
while (channel != NULL)
|
||||||
{
|
{
|
||||||
|
@@ -1728,3 +1728,9 @@ typedef int HINSTANCE;
|
|||||||
EXTERN int ctrl_break_was_pressed INIT(= FALSE);
|
EXTERN int ctrl_break_was_pressed INIT(= FALSE);
|
||||||
EXTERN HINSTANCE g_hinst INIT(= NULL);
|
EXTERN HINSTANCE g_hinst INIT(= NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(FEAT_JOB_CHANNEL)
|
||||||
|
EXTERN int did_repeated_msg INIT(= 0);
|
||||||
|
# define REPEATED_MSG_LOOKING 1
|
||||||
|
# define REPEATED_MSG_SAFESTATE 2
|
||||||
|
#endif
|
||||||
|
11
src/main.c
11
src/main.c
@@ -1122,7 +1122,16 @@ may_trigger_safestateagain(void)
|
|||||||
if (was_safe)
|
if (was_safe)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
ch_log(NULL, "SafeState: back to waiting, triggering SafeStateAgain");
|
// 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
|
#endif
|
||||||
apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
|
@@ -757,6 +757,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2075,
|
||||||
/**/
|
/**/
|
||||||
2074,
|
2074,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user