Skip to content

Commit a8343c1

Browse files
committed
patch 7.4.1260
Problem: The channel feature doesn't work on Win32 GUI. Solution: Use WSAGetLastError(). (Ken Takata)
1 parent 3fc3e14 commit a8343c1

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/channel.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,11 +954,12 @@ channel_clear(int idx)
954954
/*
955955
* Check for reading from "fd" with "timeout" msec.
956956
* Return FAIL when there is nothing to read.
957+
* Always returns OK for FEAT_GUI_W32.
957958
*/
958959
static int
959960
channel_wait(int fd, int timeout)
960961
{
961-
#ifdef HAVE_SELECT
962+
#if defined(HAVE_SELECT) && !defined(FEAT_GUI_W32)
962963
struct timeval tval;
963964
fd_set rfds;
964965
int ret;
@@ -1045,6 +1046,16 @@ channel_read(int idx)
10451046
if (len < MAXMSGSIZE)
10461047
break; /* did read everything that's available */
10471048
}
1049+
#ifdef FEAT_GUI_W32
1050+
if (len == SOCKET_ERROR)
1051+
{
1052+
/* For Win32 GUI channel_wait() always returns OK and we handle the
1053+
* situation that there is nothing to read here.
1054+
* TODO: how about a timeout? */
1055+
if (WSAGetLastError() == WSAEWOULDBLOCK)
1056+
return;
1057+
}
1058+
#endif
10481059

10491060
/* Reading a socket disconnection (readlen == 0), or a socket error. */
10501061
if (readlen <= 0)

src/testdir/test_channel.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ if !has('channel')
66
endif
77

88
" This test requires the Python command to run the test server.
9-
" This most likely only works on Unix and Windows console.
9+
" This most likely only works on Unix and Windows.
1010
if has('unix')
1111
" We also need the pkill command to make sure the server can be stopped.
1212
if !executable('python') || !executable('pkill')
1313
finish
1414
endif
15-
elseif has('win32') && !has('gui_win32')
15+
elseif has('win32')
1616
" Use Python Launcher for Windows (py.exe).
1717
if !executable('py')
1818
finish

src/version.c

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

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
1260,
745747
/**/
746748
1259,
747749
/**/

src/vim.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
519519
# ifdef HAVE_SYS_POLL_H
520520
# include <sys/poll.h>
521521
# define HAVE_POLL
522-
# elif defined(WIN32) && !defined(FEAT_GUI_W32)
522+
# elif defined(WIN32)
523523
# define HAVE_SELECT
524524
# else
525525
# ifdef HAVE_POLL_H

0 commit comments

Comments
 (0)