]> granicus.if.org Git - vim/commitdiff
patch 8.1.0238: 'buftype' is cleared when using ":term ++hidden cat" v8.1.0238
authorBram Moolenaar <Bram@vim.org>
Sat, 4 Aug 2018 14:54:11 +0000 (16:54 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 Aug 2018 14:54:11 +0000 (16:54 +0200)
Problem:    'buftype' is cleared when using ":term ++hidden cat". (Marcin
            Szamotulski)
Solution:   Set the "options initialized" flag earlier. (closes #3278)

src/terminal.c
src/testdir/test_terminal.vim
src/version.c

index 22b90c8332c25fec014c5aeebe247ff095f82737..427e027c5bc7d4b4be1fa1fc6ab8be6672f695c2 100644 (file)
@@ -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. */
index 7ab0cf8ba9a1edd136d26816aff577547ab4f780..912632470753372dbe2a51b0d9c5675599d19678 100644 (file)
@@ -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\<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
index de3a32e5edc4fe04fe58f86beb746b334f347f2b..c5f18125664b5b71e6d5c409fe228681b2cca50d 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    238,
 /**/
     237,
 /**/