Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2016-10-29 06:54:12 -07:00
3 changed files with 79 additions and 3 deletions
+48 -2
View File
@@ -50,6 +50,10 @@
# endif
#endif
#ifdef FEAT_JOB_CHANNEL
# include <tlhelp32.h>
#endif
#ifdef __MINGW32__
# ifndef FROM_LEFT_1ST_BUTTON_PRESSED
# define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
@@ -5020,6 +5024,48 @@ mch_detect_ended_job(job_T *job_list)
return NULL;
}
static BOOL
terminate_all(HANDLE process, int code)
{
PROCESSENTRY32 pe;
HANDLE h = INVALID_HANDLE_VALUE;
DWORD pid = GetProcessId(process);
if (pid != 0)
{
h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (h != INVALID_HANDLE_VALUE)
{
pe.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(h, &pe))
goto theend;
do
{
if (pe.th32ParentProcessID == pid)
{
HANDLE ph = OpenProcess(
PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
if (ph != NULL)
{
terminate_all(ph, code);
CloseHandle(ph);
}
}
} while (Process32Next(h, &pe));
CloseHandle(h);
}
}
theend:
return TerminateProcess(process, code);
}
/*
* Send a (deadly) signal to "job".
* Return FAIL if it didn't work.
*/
int
mch_stop_job(job_T *job, char_u *how)
{
@@ -5027,10 +5073,10 @@ mch_stop_job(job_T *job, char_u *how)
if (STRCMP(how, "term") == 0 || STRCMP(how, "kill") == 0 || *how == NUL)
{
/* deadly signal */
if (job->jv_job_object != NULL)
return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL;
else
return TerminateProcess(job->jv_proc_info.hProcess, 0) ? OK : FAIL;
return terminate_all(job->jv_proc_info.hProcess, 0) ? OK : FAIL;
}
if (!AttachConsole(job->jv_proc_info.dwProcessId))
+27 -1
View File
@@ -378,7 +378,7 @@ func DummyCompleteFour(findstart, base)
endif
endfunc
" Test that 'completefunc' works when it's OK.
" Test that 'omnifunc' works when it's OK.
func Test_omnifunc_with_check()
new
setlocal omnifunc=DummyCompleteFour
@@ -437,5 +437,31 @@ func Test_complete_no_undo()
q!
endfunc
function! DummyCompleteFive(findstart, base)
if a:findstart
return 0
else
return [
\ { 'word': 'January', 'info': "info1-1\n1-2\n1-3" },
\ { 'word': 'February', 'info': "info2-1\n2-2\n2-3" },
\ { 'word': 'March', 'info': "info3-1\n3-2\n3-3" },
\ { 'word': 'April', 'info': "info4-1\n4-2\n4-3" },
\ { 'word': 'May', 'info': "info5-1\n5-2\n5-3" },
\ ]
endif
endfunc
" Test that 'completefunc' on Scratch buffer with preview window works when
" it's OK.
func Test_completefunc_with_scratch_buffer()
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
set completeopt+=preview
setlocal completefunc=DummyCompleteFive
call feedkeys("A\<C-X>\<C-U>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
call assert_equal(['April'], getline(1, '$'))
pclose
q!
set completeopt&
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+4
View File
@@ -779,6 +779,10 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
54,
/**/
53,
/**/
52,
/**/