Mercurial > vim
diff src/channel.c @ 12240:24abce52ad20 v8.0.1000
patch 8.0.1000: cannot open a terminal without running a job in it
commit https://github.com/vim/vim/commit/13ebb03e7520c2c34f93444b0146640ca08e7424
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 26 22:02:51 2017 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 26 Aug 2017 22:15:04 +0200 |
parents | a1014f647b61 |
children | d0b039e2ed56 |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -503,6 +503,10 @@ channel_gui_register_one(channel_T *chan 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 /* 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 } # 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) {