aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/terminal.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 7def8c1684..fe80f7f62e 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -449,7 +449,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
if (buf->terminal) {
terminal_close(buf->terminal, NULL);
- }
+ }
/* Always remove the buffer when there is no file name. */
if (buf->b_ffname == NULL)
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index c44fe15be5..cc1de583d3 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -302,8 +302,16 @@ void terminal_close(Terminal *term, char *msg)
}
term->forward_mouse = false;
- term->closed = true;
+
+ // flush any pending changes to the buffer
+ if (!exiting) {
+ block_autocmds();
+ refresh_terminal(term);
+ unblock_autocmds();
+ }
+
buf_T *buf = handle_get_buffer(term->buf_handle);
+ term->closed = true;
if (!msg || exiting) {
// If no msg was given, this was called by close_buffer(buffer.c). Or if