1
0
forked from aniani/vim

patch 8.0.1000: cannot open a terminal without running a job in it

Problem:    Cannot open a terminal without running a job in it.
Solution:   Make ":terminal NONE" open a terminal with a pty.
This commit is contained in:
Bram Moolenaar
2017-08-26 22:02:51 +02:00
parent dde81312b0
commit 13ebb03e75
10 changed files with 140 additions and 30 deletions

View File

@@ -503,6 +503,10 @@ channel_gui_register_one(channel_T *channel, ch_part_T part)
if (!CH_HAS_GUI)
return;
/* gets stuck in handling events for a not connected channel */
if (channel->ch_keep_open)
return;
# ifdef FEAT_GUI_X11
/* Tell notifier we are interested in being called
* when there is input on the editor connection socket. */
@@ -548,9 +552,12 @@ channel_gui_register(channel_T *channel)
{
if (channel->CH_SOCK_FD != INVALID_FD)
channel_gui_register_one(channel, PART_SOCK);
if (channel->CH_OUT_FD != INVALID_FD)
if (channel->CH_OUT_FD != INVALID_FD
&& channel->CH_OUT_FD != channel->CH_SOCK_FD)
channel_gui_register_one(channel, PART_OUT);
if (channel->CH_ERR_FD != INVALID_FD)
if (channel->CH_ERR_FD != INVALID_FD
&& channel->CH_ERR_FD != channel->CH_SOCK_FD
&& channel->CH_ERR_FD != channel->CH_OUT_FD)
channel_gui_register_one(channel, PART_ERR);
}
@@ -3247,11 +3254,13 @@ channel_read(channel_T *channel, ch_part_T part, char *func)
/* Reading a disconnection (readlen == 0), or an error. */
if (readlen <= 0)
ch_close_part_on_error(channel, part, (len < 0), func);
{
if (!channel->ch_keep_open)
ch_close_part_on_error(channel, part, (len < 0), func);
}
#if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK)
/* signal the main loop that there is something to read */
if (CH_HAS_GUI && gtk_main_level() > 0)
else if (CH_HAS_GUI && gtk_main_level() > 0)
/* signal the main loop that there is something to read */
gtk_main_quit();
#endif
}
@@ -3509,13 +3518,14 @@ channel_fd2channel(sock_T fd, ch_part_T *partp)
}
# endif
# if defined(WIN32) || defined(PROTO)
# if defined(WIN32) || defined(FEAT_GUI) || defined(PROTO)
/*
* Check the channels for anything that is ready to be read.
* The data is put in the read queue.
* if "only_keep_open" is TRUE only check channels where ch_keep_open is set.
*/
void
channel_handle_events(void)
channel_handle_events(int only_keep_open)
{
channel_T *channel;
ch_part_T part;
@@ -3523,6 +3533,9 @@ channel_handle_events(void)
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
{
if (only_keep_open && !channel->ch_keep_open)
continue;
/* check the socket and pipes */
for (part = PART_SOCK; part < PART_IN; ++part)
{