diff options
author | Peter Hodge <peter.hodge84@gmail.com> | 2018-01-26 20:36:11 +0100 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2018-05-23 22:07:27 +0200 |
commit | edcc73e766438facc88db19000f054aa52ab8b13 (patch) | |
tree | 17a62cbbb7785e6f88aaa99728cfa0d8cd5e076c /src/nvim/buffer.c | |
parent | 418abfc9d06923e96f1317419fe83ed4e6d67c1d (diff) | |
download | rneovim-edcc73e766438facc88db19000f054aa52ab8b13.tar.gz rneovim-edcc73e766438facc88db19000f054aa52ab8b13.tar.bz2 rneovim-edcc73e766438facc88db19000f054aa52ab8b13.zip |
API: Implement buffer updates
Originally written by @phodge in
https://github.com/neovim/neovim/pull/5269.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index ba63822837..124e479686 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -73,6 +73,7 @@ #include "nvim/os/os.h" #include "nvim/os/time.h" #include "nvim/os/input.h" +#include "nvim/liveupdate.h" typedef enum { kBLSUnchanged = 0, @@ -574,6 +575,9 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) /* Change directories when the 'acd' option is set. */ do_autochdir(); + // disable live updates for the current buffer + liveupdate_unregister_all(buf); + /* * Remove the buffer from the list. */ @@ -784,6 +788,8 @@ free_buffer_stuff ( map_clear_int(buf, MAP_ALL_MODES, true, true); // clear local abbrevs xfree(buf->b_start_fenc); buf->b_start_fenc = NULL; + + liveupdate_unregister_all(buf); } /* @@ -1735,6 +1741,8 @@ buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags) clrallmarks(buf); /* clear marks */ fmarks_check_names(buf); /* check file marks for this file */ buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */ + kv_destroy(buf->liveupdate_channels); + kv_init(buf->liveupdate_channels); if (!(flags & BLN_DUMMY)) { // Tricky: these autocommands may change the buffer list. They could also // split the window with re-using the one empty buffer. This may result in |