summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-01 21:44:33 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-01 21:44:33 +0200
commit94053a51255121713f51c122eb0dbb46c120e6d4 (patch)
tree3e2e3a361ebd94d218551e337450005bf55d8d3e /src/buffer.c
parent0792048842493f224bbd7a5dfb348d834f61b205 (diff)
patch 8.0.0838: buffer hangs around whem terminal window is closedv8.0.0838
Problem: Buffer hangs around whem terminal window is closed. Solution: When the job has ended wipe out a terminal buffer when the window is closed.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e4b3b04f41..dd72b1ff7b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -468,6 +468,31 @@ close_buffer(
int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
int wipe_buf = (action == DOBUF_WIPE);
+#ifdef FEAT_TERMINAL
+ if (bt_terminal(buf))
+ {
+ if (term_job_running(buf->b_term))
+ {
+ if (wipe_buf)
+ /* Wiping out a terminal buffer kills the job. */
+ free_terminal(buf);
+ else
+ {
+ /* The job keeps running, hide the buffer. */
+ del_buf = FALSE;
+ unload_buf = FALSE;
+ }
+ }
+ else
+ {
+ /* A terminal buffer is wiped out if the job has finished. */
+ del_buf = TRUE;
+ unload_buf = TRUE;
+ 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