To: vim_dev@googlegroups.com Subject: Patch 7.4.1260 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1260 Problem: The channel feature doesn't work on Win32 GUI. Solution: Use WSAGetLastError(). (Ken Takata) Files: src/channel.c, src/testdir/test_channel.vim, src/vim.h *** ../vim-7.4.1259/src/channel.c 2016-02-03 23:59:39.042064651 +0100 --- src/channel.c 2016-02-04 22:04:35.939900422 +0100 *************** *** 954,964 **** /* * Check for reading from "fd" with "timeout" msec. * Return FAIL when there is nothing to read. */ static int channel_wait(int fd, int timeout) { ! #ifdef HAVE_SELECT struct timeval tval; fd_set rfds; int ret; --- 954,965 ---- /* * Check for reading from "fd" with "timeout" msec. * Return FAIL when there is nothing to read. + * Always returns OK for FEAT_GUI_W32. */ static int channel_wait(int fd, int timeout) { ! #if defined(HAVE_SELECT) && !defined(FEAT_GUI_W32) struct timeval tval; fd_set rfds; int ret; *************** *** 1045,1050 **** --- 1046,1061 ---- if (len < MAXMSGSIZE) break; /* did read everything that's available */ } + #ifdef FEAT_GUI_W32 + if (len == SOCKET_ERROR) + { + /* For Win32 GUI channel_wait() always returns OK and we handle the + * situation that there is nothing to read here. + * TODO: how about a timeout? */ + if (WSAGetLastError() == WSAEWOULDBLOCK) + return; + } + #endif /* Reading a socket disconnection (readlen == 0), or a socket error. */ if (readlen <= 0) *** ../vim-7.4.1259/src/testdir/test_channel.vim 2016-02-04 21:03:29.590326410 +0100 --- src/testdir/test_channel.vim 2016-02-04 21:58:38.312090919 +0100 *************** *** 6,18 **** endif " This test requires the Python command to run the test server. ! " This most likely only works on Unix and Windows console. if has('unix') " We also need the pkill command to make sure the server can be stopped. if !executable('python') || !executable('pkill') finish endif ! elseif has('win32') && !has('gui_win32') " Use Python Launcher for Windows (py.exe). if !executable('py') finish --- 6,18 ---- endif " This test requires the Python command to run the test server. ! " This most likely only works on Unix and Windows. if has('unix') " We also need the pkill command to make sure the server can be stopped. if !executable('python') || !executable('pkill') finish endif ! elseif has('win32') " Use Python Launcher for Windows (py.exe). if !executable('py') finish *** ../vim-7.4.1259/src/vim.h 2016-01-30 21:48:44.325034448 +0100 --- src/vim.h 2016-02-04 21:58:38.312090919 +0100 *************** *** 519,525 **** # ifdef HAVE_SYS_POLL_H # include # define HAVE_POLL ! # elif defined(WIN32) && !defined(FEAT_GUI_W32) # define HAVE_SELECT # else # ifdef HAVE_POLL_H --- 519,525 ---- # ifdef HAVE_SYS_POLL_H # include # define HAVE_POLL ! # elif defined(WIN32) # define HAVE_SELECT # else # ifdef HAVE_POLL_H *** ../vim-7.4.1259/src/version.c 2016-02-04 21:53:27.827354893 +0100 --- src/version.c 2016-02-04 21:59:55.007226294 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 1260, /**/ -- I wish there was a knob on the TV to turn up the intelligence. There's a knob called "brightness", but it doesn't seem to work. /// 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 ///