patch 8.0.1034: sending buffer lines to terminal doesn't work on MS-Windows
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.
diff --git a/src/channel.c b/src/channel.c
index b7a268a..94a762c 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1417,6 +1417,13 @@
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 @@
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))