1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0618
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.0618
Problem: term_getjob() does not return v:null as documented.
Solution: Do return v:null. (Damien) Add a test.
Files: src/terminal.c, src/testdir/test_terminal.vim
*** ../vim-8.1.0617/src/terminal.c 2018-12-21 16:04:16.316437487 +0100
--- src/terminal.c 2018-12-21 20:45:39.984928633 +0100
***************
*** 4794,4804 ****
{
buf_T *buf = term_get_buf(argvars, "term_getjob()");
- rettv->v_type = VAR_JOB;
- rettv->vval.v_job = NULL;
if (buf == NULL)
return;
rettv->vval.v_job = buf->b_term->tl_job;
if (rettv->vval.v_job != NULL)
++rettv->vval.v_job->jv_refcount;
--- 4794,4807 ----
{
buf_T *buf = term_get_buf(argvars, "term_getjob()");
if (buf == NULL)
+ {
+ rettv->v_type = VAR_SPECIAL;
+ rettv->vval.v_number = VVAL_NULL;
return;
+ }
+ rettv->v_type = VAR_JOB;
rettv->vval.v_job = buf->b_term->tl_job;
if (rettv->vval.v_job != NULL)
++rettv->vval.v_job->jv_refcount;
*** ../vim-8.1.0617/src/testdir/test_terminal.vim 2018-12-16 16:16:05.384854629 +0100
--- src/testdir/test_terminal.vim 2018-12-21 20:44:48.205306549 +0100
***************
*** 1714,1716 ****
--- 1714,1721 ----
call Stop_shell_in_terminal(bufnr)
exe bufnr . 'bwipe'
endfunc
+
+ func Test_terminal_no_job()
+ let term = term_start('false', {'term_finish': 'close'})
+ call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
+ endfunc
*** ../vim-8.1.0617/src/version.c 2018-12-21 17:59:30.100109769 +0100
--- src/version.c 2018-12-21 20:55:03.092853384 +0100
***************
*** 801,802 ****
--- 801,804 ----
{ /* Add new patch number below this line */
+ /**/
+ 618,
/**/
--
hundred-and-one symptoms of being an internet addict:
37. You start looking for hot HTML addresses in public restrooms.
/// 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 ///
|