Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
12239:658d96102102 | 12240:24abce52ad20 |
---|---|
501 channel_gui_register_one(channel_T *channel, ch_part_T part) | 501 channel_gui_register_one(channel_T *channel, ch_part_T part) |
502 { | 502 { |
503 if (!CH_HAS_GUI) | 503 if (!CH_HAS_GUI) |
504 return; | 504 return; |
505 | 505 |
506 /* gets stuck in handling events for a not connected channel */ | |
507 if (channel->ch_keep_open) | |
508 return; | |
509 | |
506 # ifdef FEAT_GUI_X11 | 510 # ifdef FEAT_GUI_X11 |
507 /* Tell notifier we are interested in being called | 511 /* Tell notifier we are interested in being called |
508 * when there is input on the editor connection socket. */ | 512 * when there is input on the editor connection socket. */ |
509 if (channel->ch_part[part].ch_inputHandler == (XtInputId)NULL) | 513 if (channel->ch_part[part].ch_inputHandler == (XtInputId)NULL) |
510 channel->ch_part[part].ch_inputHandler = XtAppAddInput( | 514 channel->ch_part[part].ch_inputHandler = XtAppAddInput( |
546 static void | 550 static void |
547 channel_gui_register(channel_T *channel) | 551 channel_gui_register(channel_T *channel) |
548 { | 552 { |
549 if (channel->CH_SOCK_FD != INVALID_FD) | 553 if (channel->CH_SOCK_FD != INVALID_FD) |
550 channel_gui_register_one(channel, PART_SOCK); | 554 channel_gui_register_one(channel, PART_SOCK); |
551 if (channel->CH_OUT_FD != INVALID_FD) | 555 if (channel->CH_OUT_FD != INVALID_FD |
556 && channel->CH_OUT_FD != channel->CH_SOCK_FD) | |
552 channel_gui_register_one(channel, PART_OUT); | 557 channel_gui_register_one(channel, PART_OUT); |
553 if (channel->CH_ERR_FD != INVALID_FD) | 558 if (channel->CH_ERR_FD != INVALID_FD |
559 && channel->CH_ERR_FD != channel->CH_SOCK_FD | |
560 && channel->CH_ERR_FD != channel->CH_OUT_FD) | |
554 channel_gui_register_one(channel, PART_ERR); | 561 channel_gui_register_one(channel, PART_ERR); |
555 } | 562 } |
556 | 563 |
557 /* | 564 /* |
558 * Register any of our file descriptors with the GUI event handling system. | 565 * Register any of our file descriptors with the GUI event handling system. |
3245 break; /* did read everything that's available */ | 3252 break; /* did read everything that's available */ |
3246 } | 3253 } |
3247 | 3254 |
3248 /* Reading a disconnection (readlen == 0), or an error. */ | 3255 /* Reading a disconnection (readlen == 0), or an error. */ |
3249 if (readlen <= 0) | 3256 if (readlen <= 0) |
3250 ch_close_part_on_error(channel, part, (len < 0), func); | 3257 { |
3251 | 3258 if (!channel->ch_keep_open) |
3259 ch_close_part_on_error(channel, part, (len < 0), func); | |
3260 } | |
3252 #if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK) | 3261 #if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK) |
3253 /* signal the main loop that there is something to read */ | 3262 else if (CH_HAS_GUI && gtk_main_level() > 0) |
3254 if (CH_HAS_GUI && gtk_main_level() > 0) | 3263 /* signal the main loop that there is something to read */ |
3255 gtk_main_quit(); | 3264 gtk_main_quit(); |
3256 #endif | 3265 #endif |
3257 } | 3266 } |
3258 | 3267 |
3259 /* | 3268 /* |
3507 } | 3516 } |
3508 return NULL; | 3517 return NULL; |
3509 } | 3518 } |
3510 # endif | 3519 # endif |
3511 | 3520 |
3512 # if defined(WIN32) || defined(PROTO) | 3521 # if defined(WIN32) || defined(FEAT_GUI) || defined(PROTO) |
3513 /* | 3522 /* |
3514 * Check the channels for anything that is ready to be read. | 3523 * Check the channels for anything that is ready to be read. |
3515 * The data is put in the read queue. | 3524 * The data is put in the read queue. |
3525 * if "only_keep_open" is TRUE only check channels where ch_keep_open is set. | |
3516 */ | 3526 */ |
3517 void | 3527 void |
3518 channel_handle_events(void) | 3528 channel_handle_events(int only_keep_open) |
3519 { | 3529 { |
3520 channel_T *channel; | 3530 channel_T *channel; |
3521 ch_part_T part; | 3531 ch_part_T part; |
3522 sock_T fd; | 3532 sock_T fd; |
3523 | 3533 |
3524 for (channel = first_channel; channel != NULL; channel = channel->ch_next) | 3534 for (channel = first_channel; channel != NULL; channel = channel->ch_next) |
3525 { | 3535 { |
3536 if (only_keep_open && !channel->ch_keep_open) | |
3537 continue; | |
3538 | |
3526 /* check the socket and pipes */ | 3539 /* check the socket and pipes */ |
3527 for (part = PART_SOCK; part < PART_IN; ++part) | 3540 for (part = PART_SOCK; part < PART_IN; ++part) |
3528 { | 3541 { |
3529 fd = channel->ch_part[part].ch_fd; | 3542 fd = channel->ch_part[part].ch_fd; |
3530 if (fd != INVALID_FD) | 3543 if (fd != INVALID_FD) |