Skip to content

Commit 9de0563

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 132598e + 74c5bbf commit 9de0563

6 files changed

Lines changed: 84 additions & 26 deletions

File tree

src/channel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ channel_open(
705705
return NULL;
706706
}
707707

708+
/* Limit the waittime to 50 msec. If it doesn't work within this
709+
* time we close the socket and try creating it again. */
710+
waitnow = waittime > 50 ? 50 : waittime;
711+
708712
/* If connect() didn't finish then try using select() to wait for the
709713
* connection to be made. For Win32 always use select() to wait. */
710714
#ifndef WIN32
@@ -720,10 +724,6 @@ channel_open(
720724
struct timeval start_tv;
721725
struct timeval end_tv;
722726
#endif
723-
/* Limit the waittime to 50 msec. If it doesn't work within this
724-
* time we close the socket and try creating it again. */
725-
waitnow = waittime > 50 ? 50 : waittime;
726-
727727
FD_ZERO(&rfds);
728728
FD_SET(sd, &rfds);
729729
FD_ZERO(&wfds);

src/eval.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11839,24 +11839,25 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
1183911839
return;
1184011840

1184111841
keys = get_tv_string(&argvars[0]);
11842-
if (*keys != NUL)
11842+
11843+
if (argvars[1].v_type != VAR_UNKNOWN)
1184311844
{
11844-
if (argvars[1].v_type != VAR_UNKNOWN)
11845+
flags = get_tv_string_buf(&argvars[1], nbuf);
11846+
for ( ; *flags != NUL; ++flags)
1184511847
{
11846-
flags = get_tv_string_buf(&argvars[1], nbuf);
11847-
for ( ; *flags != NUL; ++flags)
11848+
switch (*flags)
1184811849
{
11849-
switch (*flags)
11850-
{
11851-
case 'n': remap = FALSE; break;
11852-
case 'm': remap = TRUE; break;
11853-
case 't': typed = TRUE; break;
11854-
case 'i': insert = TRUE; break;
11855-
case 'x': execute = TRUE; break;
11856-
}
11850+
case 'n': remap = FALSE; break;
11851+
case 'm': remap = TRUE; break;
11852+
case 't': typed = TRUE; break;
11853+
case 'i': insert = TRUE; break;
11854+
case 'x': execute = TRUE; break;
1185711855
}
1185811856
}
11857+
}
1185911858

11859+
if (*keys != NUL || execute)
11860+
{
1186011861
/* Need to escape K_SPECIAL and CSI before putting the string in the
1186111862
* typeahead buffer. */
1186211863
keys_esc = vim_strsave_escape_csi(keys);

src/os_win32.c

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4992,6 +4992,41 @@ mch_call_shell(
49924992
}
49934993

49944994
#if defined(FEAT_JOB) || defined(PROTO)
4995+
static HANDLE
4996+
job_io_file_open(
4997+
char_u *fname,
4998+
DWORD dwDesiredAccess,
4999+
DWORD dwShareMode,
5000+
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
5001+
DWORD dwCreationDisposition,
5002+
DWORD dwFlagsAndAttributes)
5003+
{
5004+
HANDLE h;
5005+
# ifdef FEAT_MBYTE
5006+
WCHAR *wn = NULL;
5007+
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
5008+
{
5009+
wn = enc_to_utf16(fname, NULL);
5010+
if (wn != NULL)
5011+
{
5012+
h = CreateFileW(wn, dwDesiredAccess, dwShareMode,
5013+
lpSecurityAttributes, dwCreationDisposition,
5014+
dwFlagsAndAttributes, NULL);
5015+
vim_free(wn);
5016+
if (h == INVALID_HANDLE_VALUE
5017+
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
5018+
wn = NULL;
5019+
}
5020+
}
5021+
if (wn == NULL)
5022+
# endif
5023+
5024+
h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode,
5025+
lpSecurityAttributes, dwCreationDisposition,
5026+
dwFlagsAndAttributes, NULL);
5027+
return h;
5028+
}
5029+
49955030
void
49965031
mch_start_job(char *cmd, job_T *job, jobopt_T *options)
49975032
{
@@ -5046,13 +5081,14 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
50465081
{
50475082
char_u *fname = options->jo_io_name[PART_IN];
50485083

5049-
int fd = mch_open((char *)fname, O_RDONLY, 0);
5050-
if (fd < 0)
5084+
ifd[0] = job_io_file_open(fname, GENERIC_READ,
5085+
FILE_SHARE_READ | FILE_SHARE_WRITE,
5086+
&saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL);
5087+
if (ifd[0] == INVALID_HANDLE_VALUE)
50515088
{
50525089
EMSG2(_(e_notopen), fname);
50535090
goto failed;
50545091
}
5055-
ifd[0] = (HANDLE)_get_osfhandle(fd);
50565092
}
50575093
else if (!use_null_for_in &&
50585094
(!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
@@ -5063,13 +5099,14 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
50635099
{
50645100
char_u *fname = options->jo_io_name[PART_OUT];
50655101

5066-
int fd = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0644);
5067-
if (fd < 0)
5102+
ofd[1] = job_io_file_open(fname, GENERIC_WRITE,
5103+
FILE_SHARE_READ | FILE_SHARE_WRITE,
5104+
&saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL);
5105+
if (ofd[1] == INVALID_HANDLE_VALUE)
50685106
{
50695107
EMSG2(_(e_notopen), fname);
50705108
goto failed;
50715109
}
5072-
ofd[1] = (HANDLE)_get_osfhandle(fd);
50735110
}
50745111
else if (!use_null_for_out &&
50755112
(!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0)
@@ -5080,13 +5117,14 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
50805117
{
50815118
char_u *fname = options->jo_io_name[PART_ERR];
50825119

5083-
int fd = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
5084-
if (fd < 0)
5120+
efd[1] = job_io_file_open(fname, GENERIC_WRITE,
5121+
FILE_SHARE_READ | FILE_SHARE_WRITE,
5122+
&saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL);
5123+
if (efd[1] == INVALID_HANDLE_VALUE)
50855124
{
50865125
EMSG2(_(e_notopen), fname);
50875126
goto failed;
50885127
}
5089-
efd[1] = (HANDLE)_get_osfhandle(fd);
50905128
}
50915129
else if (!use_out_for_err && !use_null_for_err &&
50925130
(!CreatePipe(&efd[0], &efd[1], &saAttr, 0)
@@ -5126,7 +5164,7 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
51265164
jo = NULL;
51275165
}
51285166
ResumeThread(pi.hThread);
5129-
CloseHandle(job->jv_proc_info.hThread);
5167+
CloseHandle(pi.hThread);
51305168
job->jv_proc_info = pi;
51315169
job->jv_job_object = jo;
51325170
job->jv_status = JOB_STARTED;

src/testdir/test_alot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ source test_backspace_opt.vim
55
source test_cursor_func.vim
66
source test_delete.vim
77
source test_expand.vim
8+
source test_feedkeys.vim
89
source test_file_perm.vim
910
source test_glob2regpat.vim
1011
source test_join.vim

src/testdir/test_feedkeys.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
" Test feedkeys() function.
2+
3+
func Test_feedkeys_x_with_empty_string()
4+
new
5+
call feedkeys("ifoo\<Esc>")
6+
call assert_equal('', getline('.'))
7+
call feedkeys('', 'x')
8+
call assert_equal('foo', getline('.'))
9+
quit!
10+
endfunc

src/version.c

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

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
1533,
763+
/**/
764+
1532,
765+
/**/
766+
1531,
767+
/**/
768+
1530,
761769
/**/
762770
1529,
763771
/**/

0 commit comments

Comments
 (0)