aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
authorRichard Adenling <dreeze@gmail.com>2016-08-06 13:23:52 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-05-08 13:49:14 +0200
commita6f74debc01b1d76713b392819d429de7d92f875 (patch)
tree15e6aeba452d6bde23430c6354f7d21f44699c6a /src/nvim/terminal.c
parenta9605bb4aff76a934a4c39fbda093ee8fc8a1c71 (diff)
downloadrneovim-a6f74debc01b1d76713b392819d429de7d92f875.tar.gz
rneovim-a6f74debc01b1d76713b392819d429de7d92f875.tar.bz2
rneovim-a6f74debc01b1d76713b392819d429de7d92f875.zip
terminal: refresh before on_exit. #5217
References #3030 References https://github.com/radenling/vim-dispatch-neovim/issues/6 The terminal is updated by a timer, but on_exit needs the final state. Before this change, on_exit callback could see a stale terminal buffer. Helped-by: oni-link <knil.ino@gmail.com>
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c10
1 files changed, 9 insertions, 1 deletions
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