Skip to content

Commit 528ccfb

Browse files
committed
patch 8.1.0618: term_getjob() does not return v:null as documented
Problem: term_getjob() does not return v:null as documented. Solution: Do return v:null. (Damien) Add a test.
1 parent 1916673 commit 528ccfb

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/terminal.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4794,11 +4794,14 @@ f_term_getjob(typval_T *argvars, typval_T *rettv)
47944794
{
47954795
buf_T *buf = term_get_buf(argvars, "term_getjob()");
47964796

4797-
rettv->v_type = VAR_JOB;
4798-
rettv->vval.v_job = NULL;
47994797
if (buf == NULL)
4798+
{
4799+
rettv->v_type = VAR_SPECIAL;
4800+
rettv->vval.v_number = VVAL_NULL;
48004801
return;
4802+
}
48014803

4804+
rettv->v_type = VAR_JOB;
48024805
rettv->vval.v_job = buf->b_term->tl_job;
48034806
if (rettv->vval.v_job != NULL)
48044807
++rettv->vval.v_job->jv_refcount;

src/testdir/test_terminal.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,3 +1714,8 @@ func Test_stop_in_terminal()
17141714
call Stop_shell_in_terminal(bufnr)
17151715
exe bufnr . 'bwipe'
17161716
endfunc
1717+
1718+
func Test_terminal_no_job()
1719+
let term = term_start('false', {'term_finish': 'close'})
1720+
call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
1721+
endfunc

src/version.c

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

800800
static int included_patches[] =
801801
{ /* Add new patch number below this line */
802+
/**/
803+
618,
802804
/**/
803805
617,
804806
/**/

0 commit comments

Comments
 (0)