To: vim_dev@googlegroups.com Subject: Patch 7.4.1187 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1187 Problem: MS-Windows channel code only supports one channel. Doesn't build without netbeans support. Solution: Get the channel index from the socket in the message. Closes #600. Files: src/channel.c, src/netbeans.c, src/gui_w48.c, src/proto/channel.pro, src/proto/netbeans.pro *** ../vim-7.4.1186/src/channel.c 2016-01-26 23:49:27.394562297 +0100 --- src/channel.c 2016-01-27 21:03:12.282953317 +0100 *************** *** 207,213 **** /* * Tell Windows we are interested in receiving message when there * is input on the editor connection socket. - * TODO: change WM_NETBEANS to something related to the channel index. */ if (channel->ch_inputHandler == -1) channel->ch_inputHandler = --- 207,212 ---- *************** *** 648,653 **** --- 647,670 ---- #endif } + # if defined(FEAT_GUI_W32) || defined(PROTO) + /* + * Lookup the channel index from the socket. + * Returns -1 when the socket isn't found. + */ + int + channel_socket2idx(sock_T fd) + { + int i; + + if (fd >= 0) + for (i = 0; i < channel_count; ++i) + if (channels[i].ch_fd == fd) + return i; + return -1; + } + # endif + /* * Write "buf" (NUL terminated string) to channel "idx". * When "fun" is not NULL an error message might be given. *** ../vim-7.4.1186/src/netbeans.c 2016-01-26 23:27:37.384316474 +0100 --- src/netbeans.c 2016-01-27 21:03:32.822737306 +0100 *************** *** 427,440 **** } } - /* TODO: remove */ - void - netbeans_read() - { - if (nb_channel_idx >= 0) - channel_read(nb_channel_idx); - } - /* * Handle one NUL terminated command. * --- 427,432 ---- *** ../vim-7.4.1186/src/gui_w48.c 2016-01-26 23:27:37.388316432 +0100 --- src/gui_w48.c 2016-01-27 20:59:37.321214618 +0100 *************** *** 1782,1789 **** #ifdef FEAT_CHANNEL if (msg.message == WM_NETBEANS) { ! /* TODO: channel_read(idx) */ ! netbeans_read(); return; } #endif --- 1782,1791 ---- #ifdef FEAT_CHANNEL if (msg.message == WM_NETBEANS) { ! int channel_idx = channel_socket2idx((sock_T)msg.wParam); ! ! if (channel_idx >= 0) ! channel_read(channel_idx); return; } #endif *** ../vim-7.4.1186/src/proto/channel.pro 2016-01-26 23:27:37.384316474 +0100 --- src/proto/channel.pro 2016-01-27 21:02:29.075407750 +0100 *************** *** 9,14 **** --- 9,15 ---- int channel_collapse(int idx); void channel_clear(int idx); void channel_read(int idx); + int channel_socket2idx(sock_T fd); void channel_send(int idx, char_u *buf, char *fun); int channel_poll_setup(int nfd_in, void *fds_in); int channel_poll_check(int ret_in, void *fds_in); *** ../vim-7.4.1186/src/proto/netbeans.pro 2016-01-26 23:27:37.384316474 +0100 --- src/proto/netbeans.pro 2016-01-27 21:03:54.890505238 +0100 *************** *** 1,6 **** /* netbeans.c */ void netbeans_parse_messages(void); - void netbeans_read(void); int isNetbeansBuffer(buf_T *bufp); int isNetbeansModified(buf_T *bufp); void netbeans_end(void); --- 1,5 ---- *** ../vim-7.4.1186/src/version.c 2016-01-27 20:47:14.000982975 +0100 --- src/version.c 2016-01-27 21:05:53.433258820 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 1187, /**/ -- hundred-and-one symptoms of being an internet addict: 54. You start tilting your head sideways to smile. :-) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///