Skip to content

Commit 85be35f

Browse files
committed
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.
1 parent 4a1314c commit 85be35f

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

src/channel.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ channel_gui_register(int idx)
207207
/*
208208
* Tell Windows we are interested in receiving message when there
209209
* is input on the editor connection socket.
210-
* TODO: change WM_NETBEANS to something related to the channel index.
211210
*/
212211
if (channel->ch_inputHandler == -1)
213212
channel->ch_inputHandler =
@@ -648,6 +647,24 @@ channel_read(int idx)
648647
#endif
649648
}
650649

650+
# if defined(FEAT_GUI_W32) || defined(PROTO)
651+
/*
652+
* Lookup the channel index from the socket.
653+
* Returns -1 when the socket isn't found.
654+
*/
655+
int
656+
channel_socket2idx(sock_T fd)
657+
{
658+
int i;
659+
660+
if (fd >= 0)
661+
for (i = 0; i < channel_count; ++i)
662+
if (channels[i].ch_fd == fd)
663+
return i;
664+
return -1;
665+
}
666+
# endif
667+
651668
/*
652669
* Write "buf" (NUL terminated string) to channel "idx".
653670
* When "fun" is not NULL an error message might be given.

src/gui_w48.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,8 +1782,10 @@ process_message(void)
17821782
#ifdef FEAT_CHANNEL
17831783
if (msg.message == WM_NETBEANS)
17841784
{
1785-
/* TODO: channel_read(idx) */
1786-
netbeans_read();
1785+
int channel_idx = channel_socket2idx((sock_T)msg.wParam);
1786+
1787+
if (channel_idx >= 0)
1788+
channel_read(channel_idx);
17871789
return;
17881790
}
17891791
#endif

src/netbeans.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,6 @@ netbeans_parse_messages(void)
427427
}
428428
}
429429

430-
/* TODO: remove */
431-
void
432-
netbeans_read()
433-
{
434-
if (nb_channel_idx >= 0)
435-
channel_read(nb_channel_idx);
436-
}
437-
438430
/*
439431
* Handle one NUL terminated command.
440432
*

src/proto/channel.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ char_u *channel_get(int idx);
99
int channel_collapse(int idx);
1010
void channel_clear(int idx);
1111
void channel_read(int idx);
12+
int channel_socket2idx(sock_T fd);
1213
void channel_send(int idx, char_u *buf, char *fun);
1314
int channel_poll_setup(int nfd_in, void *fds_in);
1415
int channel_poll_check(int ret_in, void *fds_in);

src/proto/netbeans.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* netbeans.c */
22
void netbeans_parse_messages(void);
3-
void netbeans_read(void);
43
int isNetbeansBuffer(buf_T *bufp);
54
int isNetbeansModified(buf_T *bufp);
65
void netbeans_end(void);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ static char *(features[]) =
746746

747747
static int included_patches[] =
748748
{ /* Add new patch number below this line */
749+
/**/
750+
1187,
749751
/**/
750752
1186,
751753
/**/

0 commit comments

Comments
 (0)