aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2016-02-19 17:31:23 +0100
committerMarco Hinz <mh.codebro@gmail.com>2016-02-21 02:38:55 +0100
commitfe8b2fabe7e2ea93f8de5123beed5a6de23e2d9e (patch)
treec289913e82a75e052bed6e3ee0d105ece5a19068 /src/nvim/terminal.c
parent44024f2c65d98bb0956e7d126a695247ecca023b (diff)
downloadrneovim-fe8b2fabe7e2ea93f8de5123beed5a6de23e2d9e.tar.gz
rneovim-fe8b2fabe7e2ea93f8de5123beed5a6de23e2d9e.tar.bz2
rneovim-fe8b2fabe7e2ea93f8de5123beed5a6de23e2d9e.zip
Make TermClose event return the associated buffer
<abuf> from the TermClose event now returns the correct buffer number. Prior to this change it would always return the buffer number of the current buffer, which is obviously wrong in an async environment.
Diffstat (limited to 'src/nvim/terminal.c')
-rw-r--r--src/nvim/terminal.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 0a7807d811..bd0b994c25 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -288,8 +288,9 @@ void terminal_close(Terminal *term, char *msg)
term->forward_mouse = false;
term->closed = true;
+ buf_T *buf = handle_get_buffer(term->buf_handle);
+
if (!msg || exiting) {
- buf_T *buf = handle_get_buffer(term->buf_handle);
// If no msg was given, this was called by close_buffer(buffer.c). Or if
// exiting, we must inform the buffer the terminal no longer exists so that
// close_buffer() doesn't call this again.
@@ -304,6 +305,10 @@ void terminal_close(Terminal *term, char *msg)
} else {
terminal_receive(term, msg, strlen(msg));
}
+
+ if (buf) {
+ apply_autocmds(EVENT_TERMCLOSE, NULL, NULL, false, buf);
+ }
}
void terminal_resize(Terminal *term, uint16_t width, uint16_t height)