Skip to content

Commit 7da1fb5

Browse files
committed
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)
1 parent 87ea64c commit 7da1fb5

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/terminal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ term_start(
529529

530530
set_string_option_direct((char_u *)"buftype", -1,
531531
(char_u *)"terminal", OPT_FREE|OPT_LOCAL, 0);
532+
// Avoid that 'buftype' is reset when this buffer is entered.
533+
curbuf->b_p_initialized = TRUE;
532534

533535
/* Mark the buffer as not modifiable. It can only be made modifiable after
534536
* the job finished. */

src/testdir/test_terminal.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,3 +1605,19 @@ func Test_zz2_terminal_guioptions_bang()
16051605
set guioptions&
16061606
call delete(filename)
16071607
endfunc
1608+
1609+
func Test_terminal_hidden()
1610+
if !has('unix')
1611+
return
1612+
endif
1613+
term ++hidden cat
1614+
let bnr = bufnr('$')
1615+
call assert_equal('terminal', getbufvar(bnr, '&buftype'))
1616+
exe 'sbuf ' . bnr
1617+
call assert_equal('terminal', &buftype)
1618+
call term_sendkeys(bnr, "asdf\<CR>")
1619+
call WaitForAssert({-> assert_match('asdf', term_getline(bnr, 2))})
1620+
call term_sendkeys(bnr, "\<C-D>")
1621+
call WaitForAssert({-> assert_equal('finished', term_getstatus(bnr))})
1622+
bwipe!
1623+
endfunc

src/version.c

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

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
238,
797799
/**/
798800
237,
799801
/**/

0 commit comments

Comments
 (0)