diff src/channel.c @ 12072:f4e1e1e6886b v8.0.0916

patch 8.0.0916: cannot specify properties of window for terminal open commit https://github.com/vim/vim/commit/37c45835945fc433a3bb85fcfc0b4fd58b1ee0e7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 12 16:01:04 2017 +0200 patch 8.0.0916: cannot specify properties of window for terminal open Problem: Cannot specify properties of window for when opening a window for a finished terminal job. Solution: Add "term_opencmd".
author Christian Brabandt <cb@256bit.org>
date Sat, 12 Aug 2017 16:15:04 +0200
parents 407a475c67fd
children 0a61213afdd2
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -4434,6 +4434,28 @@ get_job_options(typval_T *tv, jobopt_T *
 		opt->jo_set2 |= JO2_TERM_FINISH;
 		opt->jo_term_finish = *val;
 	    }
+	    else if (STRCMP(hi->hi_key, "term_opencmd") == 0)
+	    {
+		char_u *p;
+
+		if (!(supported2 & JO2_TERM_OPENCMD))
+		    break;
+		opt->jo_set2 |= JO2_TERM_OPENCMD;
+		p = opt->jo_term_opencmd = get_tv_string_chk(item);
+		if (p != NULL)
+		{
+		    /* Must have %d and no other %. */
+		    p = vim_strchr(p, '%');
+		    if (p != NULL && (p[1] != 'd'
+					    || vim_strchr(p + 2, '%') != NULL))
+			p = NULL;
+		}
+		if (p == NULL)
+		{
+		    EMSG2(_(e_invarg2), "term_opencmd");
+		    return FAIL;
+		}
+	    }
 	    else if (STRCMP(hi->hi_key, "term_rows") == 0)
 	    {
 		if (!(supported2 & JO2_TERM_ROWS))