]> granicus.if.org Git - vim/commitdiff
patch 8.2.0862: ":term ++curwin" makes the current buffer hidden v8.2.0862
authorBram Moolenaar <Bram@vim.org>
Sun, 31 May 2020 14:04:42 +0000 (16:04 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 31 May 2020 14:04:42 +0000 (16:04 +0200)
Problem:    ":term ++curwin" makes the current buffer hidden. (Harm te
            Hennepe)
Solution:   Do not hide the current buffer. (closes #6170)

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

index 86a1a0fc3519f03e5eb7fb73fa75ee72c1342aac..5514c73ea04a030d20b8a4f25011dad334d75068 100644 (file)
@@ -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;
index a8a549cbd9c10013c708e2ee9dd631ff7545e161..7430eb2e0b468380ad91e32617cdd7f5661711ad 100644 (file)
@@ -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()
index d1ebe5b1a397e34b7f334172329d5bada3443d27..c39e7123d95c9f8e31266344aa7ab15ae8fc90e6 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    862,
 /**/
     861,
 /**/