summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-02 14:54:21 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-02 14:54:21 +0200
commit3346cc4ffb459ecddb97a8c19bcc5834afa4dead (patch)
tree0c911bd400c68687eafebf5d7be41df5cf67afe3 /src/channel.c
parent995e4afcfe60aa3c214ba680e7b027a4e05cf62b (diff)
patch 8.0.1034: sending buffer lines to terminal doesn't work on MS-Windowsv8.0.1034
Problem: Sending buffer lines to terminal doesn't work on MS-Windows. Solution: Send CTRL-D to mark the end of the text. (Yasuhiro Matsumoto, closes #2043) Add the "eof_chars" option.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/channel.c b/src/channel.c
index b7a268a79a..94a762c610 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1417,6 +1417,13 @@ channel_write_in(channel_T *channel)
in_part->ch_buf_top = lnum;
if (lnum > buf->b_ml.ml_line_count || lnum > in_part->ch_buf_bot)
{
+#if defined(WIN32) && defined(FEAT_TERMINAL)
+ /* Send CTRL-D or "eof_chars" to close stdin on Windows. A console
+ * application doesn't treat closing stdin like UNIX. */
+ if (channel->ch_job != NULL)
+ term_send_eof(channel);
+#endif
+
/* Writing is done, no longer need the buffer. */
in_part->ch_bufref.br_buf = NULL;
ch_log(channel, "Finished writing all lines to channel");
@@ -4626,6 +4633,22 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
return FAIL;
}
}
+ else if (STRCMP(hi->hi_key, "eof_chars") == 0)
+ {
+# ifdef WIN3264
+ char_u *p;
+
+ if (!(supported2 & JO2_EOF_CHARS))
+ break;
+ opt->jo_set2 |= JO2_EOF_CHARS;
+ p = opt->jo_eof_chars = get_tv_string_chk(item);
+ if (p == NULL)
+ {
+ EMSG2(_(e_invarg2), "term_opencmd");
+ return FAIL;
+ }
+# endif
+ }
else if (STRCMP(hi->hi_key, "term_rows") == 0)
{
if (!(supported2 & JO2_TERM_ROWS))