From: Bram Moolenaar Date: Sat, 4 Aug 2018 14:54:11 +0000 (+0200) Subject: patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat" X-Git-Tag: v8.1.0238 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7da1fb5532890d9c15cdb5b9bec158f9f9c105a7;p=vim 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/terminal.c b/src/terminal.c index 22b90c833..427e027c5 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -529,6 +529,8 @@ term_start( set_string_option_direct((char_u *)"buftype", -1, (char_u *)"terminal", OPT_FREE|OPT_LOCAL, 0); + // Avoid that 'buftype' is reset when this buffer is entered. + curbuf->b_p_initialized = TRUE; /* Mark the buffer as not modifiable. It can only be made modifiable after * the job finished. */ diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 7ab0cf8ba..912632470 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1605,3 +1605,19 @@ func Test_zz2_terminal_guioptions_bang() 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\") + call WaitForAssert({-> assert_match('asdf', term_getline(bnr, 2))}) + call term_sendkeys(bnr, "\") + call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))}) + bwipe! +endfunc diff --git a/src/version.c b/src/version.c index de3a32e5e..c5f181256 100644 --- a/src/version.c +++ b/src/version.c @@ -794,6 +794,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 238, /**/ 237, /**/