changeset 20617:c81f61e3b508 v8.2.0862

patch 8.2.0862: ":term ++curwin" makes the current buffer hidden Commit: https://github.com/vim/vim/commit/b10090928cb5283f867e8457b7eea0985470d8d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 31 16:04:42 2020 +0200 patch 8.2.0862: ":term ++curwin" makes the current buffer hidden Problem: ":term ++curwin" makes the current buffer hidden. (Harm te Hennepe) Solution: Do not hide the current buffer. (closes #6170)
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 May 2020 16:15:03 +0200
parents 3c58d3e60e98
children 8b79d6353530
files src/terminal.c src/testdir/test_terminal.vim src/version.c
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -459,9 +459,9 @@ term_start(
 	    return NULL;
 	}
 	if (do_ecmd(0, NULL, NULL, &split_ea, ECMD_ONE,
-		     ECMD_HIDE
-			   + ((flags & TERM_START_FORCEIT) ? ECMD_FORCEIT : 0),
-		     curwin) == FAIL)
+		      (buf_hide(curwin->w_buffer) ? ECMD_HIDE : 0)
+			  + ((flags & TERM_START_FORCEIT) ? ECMD_FORCEIT : 0),
+							       curwin) == FAIL)
 	{
 	    vim_free(term);
 	    return NULL;
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -450,17 +450,21 @@ func Test_terminal_curwin()
   let cmd = Get_cat_123_cmd()
   call assert_equal(1, winnr('$'))
 
-  split dummy
+  split Xdummy
+  call setline(1, 'dummy')
+  write
+  call assert_equal(1, getbufinfo('Xdummy')[0].loaded)
   exe 'terminal ++curwin ' . cmd
   call assert_equal(2, winnr('$'))
+  call assert_equal(0, getbufinfo('Xdummy')[0].loaded)
   bwipe!
 
-  split dummy
+  split Xdummy
   call term_start(cmd, {'curwin': 1})
   call assert_equal(2, winnr('$'))
   bwipe!
 
-  split dummy
+  split Xdummy
   call setline(1, 'change')
   call assert_fails('terminal ++curwin ' . cmd, 'E37:')
   call assert_equal(2, winnr('$'))
@@ -468,15 +472,16 @@ func Test_terminal_curwin()
   call assert_equal(2, winnr('$'))
   bwipe!
 
-  split dummy
+  split Xdummy
   call setline(1, 'change')
   call assert_fails("call term_start(cmd, {'curwin': 1})", 'E37:')
   call assert_equal(2, winnr('$'))
   bwipe!
 
-  split dummy
+  split Xdummy
   bwipe!
   call delete('Xtext')
+  call delete('Xdummy')
 endfunc
 
 func s:get_sleep_cmd()
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    862,
+/**/
     861,
 /**/
     860,