diff options
author | KillTheMule <KillTheMule@users.noreply.github.com> | 2018-01-26 17:42:51 +0100 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2018-05-23 22:07:27 +0200 |
commit | 8bcc01195968b84d1a74ecb82598bdf538004404 (patch) | |
tree | 3f730cd4048d22c5c2de53409a599e342dec66b5 /src/nvim/api/buffer.c | |
parent | 71816e584cef01c195797e738e1d6dba1de39102 (diff) | |
download | rneovim-8bcc01195968b84d1a74ecb82598bdf538004404.tar.gz rneovim-8bcc01195968b84d1a74ecb82598bdf538004404.tar.bz2 rneovim-8bcc01195968b84d1a74ecb82598bdf538004404.zip |
Make separate functions to start/stop live updates
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 44e274484a..2c7480a16b 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -78,15 +78,14 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err) /// Activate live updates from this buffer to the current channel. /// -/// /// @param buffer The buffer handle -/// @param enabled True turns on live updates, False turns them off. +/// @param send_buffer Set to true if the initial notification should contain +/// the whole buffer /// @param[out] err Details of an error that may have occurred /// @return False when live updates couldn't be enabled because the buffer isn't /// loaded; otherwise True. -Boolean nvim_buf_live_updates(uint64_t channel_id, +Boolean nvim_buf_live_updates_start(uint64_t channel_id, Buffer buffer, - Boolean enabled, Boolean send_buffer, Error *err) FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY @@ -97,8 +96,25 @@ Boolean nvim_buf_live_updates(uint64_t channel_id, return false; } - if (enabled) { - return liveupdate_register(buf, channel_id, send_buffer); + return liveupdate_register(buf, channel_id, send_buffer); + +} +// +/// Deactivate live updates from this buffer to the current channel. +/// +/// @param buffer The buffer handle +/// @param[out] err Details of an error that may have occurred +/// @return False when live updates couldn't be disabled because the buffer +/// isn't loaded; otherwise True. +Boolean nvim_buf_live_updates_stop(uint64_t channel_id, + Buffer buffer, + Error *err) + FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY +{ + buf_T *buf = find_buffer_by_handle(buffer, err); + + if (!buf) { + return false; } liveupdate_unregister(buf, channel_id); |