@@ -397,7 +397,7 @@ mch_inchar(
397397
398398 if (wtime >= 0 )
399399 {
400- while (WaitForChar (wtime ) == 0 ) /* no character available */
400+ while (! WaitForChar (wtime )) /* no character available */
401401 {
402402 if (do_resize )
403403 handle_resize ();
@@ -420,7 +420,7 @@ mch_inchar(
420420 * flush all the swap files to disk.
421421 * Also done when interrupted by SIGWINCH.
422422 */
423- if (WaitForChar (p_ut ) == 0 )
423+ if (! WaitForChar (p_ut ))
424424 {
425425#ifdef FEAT_AUTOCMD
426426 if (trigger_cursorhold () && maxlen >= 3
@@ -448,7 +448,7 @@ mch_inchar(
448448 * We want to be interrupted by the winch signal
449449 * or by an event on the monitored file descriptors.
450450 */
451- if (WaitForChar (-1L ) == 0 )
451+ if (! WaitForChar (-1L ))
452452 {
453453 if (do_resize ) /* interrupted by SIGWINCH signal */
454454 handle_resize ();
@@ -482,7 +482,7 @@ handle_resize(void)
482482}
483483
484484/*
485- * return non-zero if a character is available
485+ * Return non-zero if a character is available.
486486 */
487487 int
488488mch_char_avail (void )
@@ -5210,7 +5210,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
52105210 /* See above for type of argv. */
52115211 execvp (argv [0 ], argv );
52125212
5213- perror ("executing job failed" );
5213+ // perror("executing job failed");
52145214 _exit (EXEC_FAILED ); /* exec failed, return failure code */
52155215 }
52165216
@@ -5359,6 +5359,7 @@ mch_breakcheck(void)
53595359 * "msec" == -1 will block forever.
53605360 * Invokes timer callbacks when needed.
53615361 * When a GUI is being used, this will never get called -- webb
5362+ * Returns TRUE when a character is available.
53625363 */
53635364 static int
53645365WaitForChar (long msec )
@@ -5367,6 +5368,7 @@ WaitForChar(long msec)
53675368 long due_time ;
53685369 long remaining = msec ;
53695370 int break_loop = FALSE;
5371+ int tb_change_cnt = typebuf .tb_change_cnt ;
53705372
53715373 /* When waiting very briefly don't trigger timers. */
53725374 if (msec >= 0 && msec < 10L )
@@ -5377,6 +5379,11 @@ WaitForChar(long msec)
53775379 /* Trigger timers and then get the time in msec until the next one is
53785380 * due. Wait up to that time. */
53795381 due_time = check_due_timer ();
5382+ if (typebuf .tb_change_cnt != tb_change_cnt )
5383+ {
5384+ /* timer may have used feedkeys() */
5385+ return FALSE;
5386+ }
53805387 if (due_time <= 0 || (msec > 0 && due_time > remaining ))
53815388 due_time = remaining ;
53825389 if (WaitForCharOrMouse (due_time , & break_loop ))
0 commit comments