• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révision1456b8e4d4890320c31f01f5b31bc28b8b0e2012 (tree)
l'heure2020-11-25 03:45:03
AuteurBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Message de Log

patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"

Commit: https://github.com/vim/vim/commit/c9f8b849b6de9661e543d0d1431e233725dd956f
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 24 19:36:16 2020 +0100

patch 8.2.2040: terminal buffer disappears even when 'bufhidden' is "hide"
Problem: Terminal buffer disappears even when 'bufhidden' is "hide".
(Sergey Vlasov)
Solution: Check 'bufhiddden' when a terminal buffer becomes hidden.
(closes #7358)

Change Summary

Modification

diff -r 464aed98daf3 -r 1456b8e4d489 src/buffer.c
--- a/src/buffer.c Mon Nov 23 22:15:05 2020 +0100
+++ b/src/buffer.c Tue Nov 24 19:45:03 2020 +0100
@@ -552,6 +552,11 @@
552552 unload_buf = FALSE;
553553 }
554554 }
555+ else if (buf->b_p_bh[0] == 'h' && !del_buf)
556+ {
557+ // Hide a terminal buffer.
558+ unload_buf = FALSE;
559+ }
555560 else
556561 {
557562 // A terminal buffer is wiped out if the job has finished.
diff -r 464aed98daf3 -r 1456b8e4d489 src/testdir/test_terminal.vim
--- a/src/testdir/test_terminal.vim Mon Nov 23 22:15:05 2020 +0100
+++ b/src/testdir/test_terminal.vim Tue Nov 24 19:45:03 2020 +0100
@@ -123,7 +123,7 @@
123123 unlet g:job
124124 endfunc
125125
126-func Test_terminal_hide_buffer()
126+func Test_terminal_hide_buffer_job_running()
127127 let buf = Run_shell_in_terminal({})
128128 setlocal bufhidden=hide
129129 quit
@@ -140,6 +140,25 @@
140140 unlet g:job
141141 endfunc
142142
143+func Test_terminal_hide_buffer_job_finished()
144+ term echo hello
145+ let buf = bufnr()
146+ setlocal bufhidden=hide
147+ call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
148+ call assert_true(bufloaded(buf))
149+ call assert_true(buflisted(buf))
150+ edit Xasdfasdf
151+ call assert_true(bufloaded(buf))
152+ call assert_true(buflisted(buf))
153+ exe buf .. 'buf'
154+ call assert_equal(buf, bufnr())
155+ setlocal bufhidden=
156+ edit Xasdfasdf
157+ call assert_false(bufloaded(buf))
158+ call assert_false(buflisted(buf))
159+ bwipe Xasdfasdf
160+endfunc
161+
143162 func s:Nasty_exit_cb(job, st)
144163 exe g:buf . 'bwipe!'
145164 let g:buf = 0
diff -r 464aed98daf3 -r 1456b8e4d489 src/version.c
--- a/src/version.c Mon Nov 23 22:15:05 2020 +0100
+++ b/src/version.c Tue Nov 24 19:45:03 2020 +0100
@@ -751,6 +751,8 @@
751751 static int included_patches[] =
752752 { /* Add new patch number below this line */
753753 /**/
754+ 2040,
755+/**/
754756 2039,
755757 /**/
756758 2038,
Afficher sur ancien navigateur de dépôt.