diff src/terminal.c @ 11949:74e45c11b754 v8.0.0854

patch 8.0.0854: no redraw after terminal was closed commit https://github.com/vim/vim/commit/e9c21aed6233185e7fbe1b462a0571c0e460a5a9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 3 20:44:48 2017 +0200 patch 8.0.0854: no redraw after terminal was closed Problem: No redraw after terminal was closed. Solution: Set typebuf_was_filled. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/1925, closes #1924) Add function to check for messages even when input is available.
author Christian Brabandt <cb@256bit.org>
date Thu, 03 Aug 2017 20:45:04 +0200
parents 8b9a1be7bb82
children e8b1ef40324a
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1305,6 +1305,7 @@ term_channel_closed(channel_T *ch)
 
 	/* Need to break out of vgetc(). */
 	ins_char_typebuf(K_IGNORE);
+	typebuf_was_filled = TRUE;
 
 	term = curbuf->b_term;
 	if (term != NULL)
@@ -2140,31 +2141,36 @@ f_term_wait(typval_T *argvars, typval_T 
 	ch_log(NULL, "term_wait(): invalid argument");
 	return;
     }
+    if (buf->b_term->tl_job == NULL)
+    {
+	ch_log(NULL, "term_wait(): no job to wait for");
+	return;
+    }
 
     /* Get the job status, this will detect a job that finished. */
-    if (buf->b_term->tl_job == NULL
-	    || STRCMP(job_status(buf->b_term->tl_job), "dead") == 0)
+    if (STRCMP(job_status(buf->b_term->tl_job), "dead") == 0)
     {
 	/* The job is dead, keep reading channel I/O until the channel is
 	 * closed. */
+	ch_log(NULL, "term_wait(): waiting for channel to close");
 	while (buf->b_term != NULL && !buf->b_term->tl_channel_closed)
 	{
-	    mch_char_avail();
+	    mch_check_messages();
 	    parse_queued_messages();
 	    ui_delay(10L, FALSE);
 	}
-	mch_char_avail();
+	mch_check_messages();
 	parse_queued_messages();
     }
     else
     {
-	mch_char_avail();
+	mch_check_messages();
 	parse_queued_messages();
 
 	/* Wait for 10 msec for any channel I/O. */
 	/* TODO: use delay from optional argument */
 	ui_delay(10L, TRUE);
-	mch_char_avail();
+	mch_check_messages();
 
 	/* Flushing messages on channels is hopefully sufficient.
 	 * TODO: is there a better way? */