diff src/channel.c @ 11670:3b2afa2b77b3 v8.0.0718

patch 8.0.0718: output of job in terminal is not displayed commit https://github.com/vim/vim/commit/cb8bbe9bf3214d07580d6b43d6539416884153bd Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 16 13:48:22 2017 +0200 patch 8.0.0718: output of job in terminal is not displayed Problem: Output of job in terminal is not displayed. Solution: Connect the job output to the terminal.
author Christian Brabandt <cb@256bit.org>
date Sun, 16 Jul 2017 14:00:03 +0200
parents 5cd9ba96561d
children 3c6cc2f24645
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -171,7 +171,7 @@ ch_log(channel_T *ch, char *msg)
     }
 }
 
-    static void
+    void
 ch_logn(channel_T *ch, char *msg, int nr)
 {
     if (log_fd != NULL)
@@ -2656,7 +2656,12 @@ may_invoke_callback(channel_T *channel, 
 		/* JSON or JS mode: re-encode the message. */
 		msg = json_encode(listtv, ch_mode);
 	    if (msg != NULL)
-		append_to_buffer(buffer, msg, channel, part);
+	    {
+		if (buffer->b_term != NULL)
+		    write_to_term(buffer, msg, channel);
+		else
+		    append_to_buffer(buffer, msg, channel, part);
+	    }
 	}
 
 	if (callback != NULL)
@@ -4889,7 +4894,7 @@ job_check_ended(void)
  * "job_start()" function
  */
     job_T *
-job_start(typval_T *argvars)
+job_start(typval_T *argvars, jobopt_T *opt_arg)
 {
     job_T	*job;
     char_u	*cmd = NULL;
@@ -4912,13 +4917,18 @@ job_start(typval_T *argvars)
     ga_init2(&ga, (int)sizeof(char*), 20);
 #endif
 
-    /* Default mode is NL. */
-    clear_job_options(&opt);
-    opt.jo_mode = MODE_NL;
-    if (get_job_options(&argvars[1], &opt,
+    if (opt_arg != NULL)
+	opt = *opt_arg;
+    else
+    {
+	/* Default mode is NL. */
+	clear_job_options(&opt);
+	opt.jo_mode = MODE_NL;
+	if (get_job_options(&argvars[1], &opt,
 	    JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
 			   + JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL)
 	goto theend;
+    }
 
     /* Check that when io is "file" that there is a file name. */
     for (part = PART_OUT; part < PART_COUNT; ++part)