1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2017-09-02 14:54:21 +02:00
parent 995e4afcfe
commit 3346cc4ffb
6 changed files with 59 additions and 6 deletions

View File

@@ -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))