patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat"
Problem: 'buftype' is cleared when using ":term ++hidden cat". (Marcin
Szamotulski)
Solution: Set the "options initialized" flag earlier. (closes #3278)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 7ab0cf8..9126324 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1605,3 +1605,19 @@
set guioptions&
call delete(filename)
endfunc
+
+func Test_terminal_hidden()
+ if !has('unix')
+ return
+ endif
+ term ++hidden cat
+ let bnr = bufnr('$')
+ call assert_equal('terminal', getbufvar(bnr, '&buftype'))
+ exe 'sbuf ' . bnr
+ call assert_equal('terminal', &buftype)
+ call term_sendkeys(bnr, "asdf\<CR>")
+ call WaitForAssert({-> assert_match('asdf', term_getline(bnr, 2))})
+ call term_sendkeys(bnr, "\<C-D>")
+ call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))})
+ bwipe!
+endfunc