Patch 8.2.2040
Problem:    Terminal buffer disappears even when 'bufhidden' is "hide".
            (Sergey Vlasov)
Solution:   Check 'bufhiddden' when a terminal buffer becomes hidden.
            (closes #7358)
Files:      src/buffer.c, src/testdir/test_terminal.vim


*** ../vim-8.2.2039/src/buffer.c        2020-11-05 19:36:34.706317028 +0100
--- src/buffer.c        2020-11-24 19:35:30.018423757 +0100
***************
*** 552,557 ****
--- 552,562 ----
                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.
*** ../vim-8.2.2039/src/testdir/test_terminal.vim       2020-11-18 
12:23:55.129054817 +0100
--- src/testdir/test_terminal.vim       2020-11-24 19:33:28.610898314 +0100
***************
*** 123,129 ****
    unlet g:job
  endfunc
  
! func Test_terminal_hide_buffer()
    let buf = Run_shell_in_terminal({})
    setlocal bufhidden=hide
    quit
--- 123,129 ----
    unlet g:job
  endfunc
  
! func Test_terminal_hide_buffer_job_running()
    let buf = Run_shell_in_terminal({})
    setlocal bufhidden=hide
    quit
***************
*** 140,145 ****
--- 140,164 ----
    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
*** ../vim-8.2.2039/src/version.c       2020-11-23 22:01:22.642662389 +0100
--- src/version.c       2020-11-24 19:35:26.978435810 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2040,
  /**/

-- 
Overflow on /dev/null, please empty the bit bucket.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202011241836.0AOIajmL1827416%40masaka.moolenaar.net.

Raspunde prin e-mail lui