diff src/buffer.c @ 12479:65c7769ef6d1 v8.0.1119

patch 8.0.1119: quitting a split terminal window kills the job commit https://github.com/vim/vim/commit/8adb0d03ca2694922da915356d7ede05e31c5a5c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Sep 17 19:08:02 2017 +0200 patch 8.0.1119: quitting a split terminal window kills the job Problem: Quitting a split terminal window kills the job. (Yasuhiro Matsumoto) Solution: Only stop terminal job if it is the last window.
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Sep 2017 19:15:05 +0200
parents 68d7bc045dbe
children 31737ff54115
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -466,8 +466,27 @@ close_buffer(
     int		del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
     int		wipe_buf = (action == DOBUF_WIPE);
 
+    /*
+     * Force unloading or deleting when 'bufhidden' says so.
+     * The caller must take care of NOT deleting/freeing when 'bufhidden' is
+     * "hide" (otherwise we could never free or delete a buffer).
+     */
+    if (buf->b_p_bh[0] == 'd')		/* 'bufhidden' == "delete" */
+    {
+	del_buf = TRUE;
+	unload_buf = TRUE;
+    }
+    else if (buf->b_p_bh[0] == 'w')	/* 'bufhidden' == "wipe" */
+    {
+	del_buf = TRUE;
+	unload_buf = TRUE;
+	wipe_buf = TRUE;
+    }
+    else if (buf->b_p_bh[0] == 'u')	/* 'bufhidden' == "unload" */
+	unload_buf = TRUE;
+
 #ifdef FEAT_TERMINAL
-    if (bt_terminal(buf))
+    if (bt_terminal(buf) && (buf->b_nwindows == 1 || del_buf))
     {
 	if (term_job_running(buf->b_term))
 	{
@@ -489,26 +508,7 @@ close_buffer(
 	    wipe_buf = TRUE;
 	}
     }
-    else
-#endif
-    /*
-     * Force unloading or deleting when 'bufhidden' says so.
-     * The caller must take care of NOT deleting/freeing when 'bufhidden' is
-     * "hide" (otherwise we could never free or delete a buffer).
-     */
-    if (buf->b_p_bh[0] == 'd')		/* 'bufhidden' == "delete" */
-    {
-	del_buf = TRUE;
-	unload_buf = TRUE;
-    }
-    else if (buf->b_p_bh[0] == 'w')	/* 'bufhidden' == "wipe" */
-    {
-	del_buf = TRUE;
-	unload_buf = TRUE;
-	wipe_buf = TRUE;
-    }
-    else if (buf->b_p_bh[0] == 'u')	/* 'bufhidden' == "unload" */
-	unload_buf = TRUE;
+#endif
 
 #ifdef FEAT_AUTOCMD
     /* Disallow deleting the buffer when it is locked (already being closed or