Skip to content

Commit 4dfba19

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 89be02e + fb63090 commit 4dfba19

3 files changed

Lines changed: 79 additions & 3 deletions

File tree

src/os_win32.c

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
# endif
5151
#endif
5252

53+
#ifdef FEAT_JOB_CHANNEL
54+
# include <tlhelp32.h>
55+
#endif
56+
5357
#ifdef __MINGW32__
5458
# ifndef FROM_LEFT_1ST_BUTTON_PRESSED
5559
# define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
@@ -5020,17 +5024,59 @@ mch_detect_ended_job(job_T *job_list)
50205024
return NULL;
50215025
}
50225026

5027+
static BOOL
5028+
terminate_all(HANDLE process, int code)
5029+
{
5030+
PROCESSENTRY32 pe;
5031+
HANDLE h = INVALID_HANDLE_VALUE;
5032+
DWORD pid = GetProcessId(process);
5033+
5034+
if (pid != 0)
5035+
{
5036+
h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
5037+
if (h != INVALID_HANDLE_VALUE)
5038+
{
5039+
pe.dwSize = sizeof(PROCESSENTRY32);
5040+
if (!Process32First(h, &pe))
5041+
goto theend;
5042+
5043+
do
5044+
{
5045+
if (pe.th32ParentProcessID == pid)
5046+
{
5047+
HANDLE ph = OpenProcess(
5048+
PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID);
5049+
if (ph != NULL)
5050+
{
5051+
terminate_all(ph, code);
5052+
CloseHandle(ph);
5053+
}
5054+
}
5055+
} while (Process32Next(h, &pe));
5056+
5057+
CloseHandle(h);
5058+
}
5059+
}
5060+
5061+
theend:
5062+
return TerminateProcess(process, code);
5063+
}
5064+
5065+
/*
5066+
* Send a (deadly) signal to "job".
5067+
* Return FAIL if it didn't work.
5068+
*/
50235069
int
50245070
mch_stop_job(job_T *job, char_u *how)
50255071
{
50265072
int ret;
50275073

50285074
if (STRCMP(how, "term") == 0 || STRCMP(how, "kill") == 0 || *how == NUL)
50295075
{
5076+
/* deadly signal */
50305077
if (job->jv_job_object != NULL)
50315078
return TerminateJobObject(job->jv_job_object, 0) ? OK : FAIL;
5032-
else
5033-
return TerminateProcess(job->jv_proc_info.hProcess, 0) ? OK : FAIL;
5079+
return terminate_all(job->jv_proc_info.hProcess, 0) ? OK : FAIL;
50345080
}
50355081

50365082
if (!AttachConsole(job->jv_proc_info.dwProcessId))

src/testdir/test_popup.vim

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func DummyCompleteFour(findstart, base)
378378
endif
379379
endfunc
380380

381-
" Test that 'completefunc' works when it's OK.
381+
" Test that 'omnifunc' works when it's OK.
382382
func Test_omnifunc_with_check()
383383
new
384384
setlocal omnifunc=DummyCompleteFour
@@ -437,5 +437,31 @@ func Test_complete_no_undo()
437437
q!
438438
endfunc
439439

440+
function! DummyCompleteFive(findstart, base)
441+
if a:findstart
442+
return 0
443+
else
444+
return [
445+
\ { 'word': 'January', 'info': "info1-1\n1-2\n1-3" },
446+
\ { 'word': 'February', 'info': "info2-1\n2-2\n2-3" },
447+
\ { 'word': 'March', 'info': "info3-1\n3-2\n3-3" },
448+
\ { 'word': 'April', 'info': "info4-1\n4-2\n4-3" },
449+
\ { 'word': 'May', 'info': "info5-1\n5-2\n5-3" },
450+
\ ]
451+
endif
452+
endfunc
453+
454+
" Test that 'completefunc' on Scratch buffer with preview window works when
455+
" it's OK.
456+
func Test_completefunc_with_scratch_buffer()
457+
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
458+
set completeopt+=preview
459+
setlocal completefunc=DummyCompleteFive
460+
call feedkeys("A\<C-X>\<C-U>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
461+
call assert_equal(['April'], getline(1, '$'))
462+
pclose
463+
q!
464+
set completeopt&
465+
endfunc
440466

441467
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,10 @@ static char *(features[]) =
779779

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
54,
784+
/**/
785+
53,
782786
/**/
783787
52,
784788
/**/

0 commit comments

Comments
 (0)