unload_buf = FALSE;
}
}
+ else if (buf->b_p_bh[0] == 'h' && !del_buf)
+ {
+ // Hide a terminal buffer.
+ unload_buf = FALSE;
+ }
else
{
// A terminal buffer is wiped out if the job has finished.
unlet g:job
endfunc
-func Test_terminal_hide_buffer()
+func Test_terminal_hide_buffer_job_running()
let buf = Run_shell_in_terminal({})
setlocal bufhidden=hide
quit
unlet g:job
endfunc
+func Test_terminal_hide_buffer_job_finished()
+ term echo hello
+ let buf = bufnr()
+ setlocal bufhidden=hide
+ call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
+ call assert_true(bufloaded(buf))
+ call assert_true(buflisted(buf))
+ edit Xasdfasdf
+ call assert_true(bufloaded(buf))
+ call assert_true(buflisted(buf))
+ exe buf .. 'buf'
+ call assert_equal(buf, bufnr())
+ setlocal bufhidden=
+ edit Xasdfasdf
+ call assert_false(bufloaded(buf))
+ call assert_false(buflisted(buf))
+ bwipe Xasdfasdf
+endfunc
+
func s:Nasty_exit_cb(job, st)
exe g:buf . 'bwipe!'
let g:buf = 0