summaryrefslogtreecommitdiffstats
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-26 22:02:51 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-26 22:02:51 +0200
commit13ebb03e7520c2c34f93444b0146640ca08e7424 (patch)
tree6a56af98898e32e5aa48fb80fb5fce1248e1ec24 /src/channel.c
parentdde81312b031211752d1fcb8539d79f90f324a2e (diff)
patch 8.0.1000: cannot open a terminal without running a job in itv8.0.1000
Problem: Cannot open a terminal without running a job in it. Solution: Make ":terminal NONE" open a terminal with a pty.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/channel.c b/src/channel.c
index 1680d0dd1e..b31d95d41c 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -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)
{