diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-12-15 22:18:35 +0100 |
---|---|---|
committer | Thomas Vigouroux <tomvig38@gmail.com> | 2020-12-15 22:29:27 +0100 |
commit | 25e20da550b0d267013ac295756bad76f5fda7ef (patch) | |
tree | 6678ef7dae44dbc9419a25b5159cb1215554ab3b /src/nvim/api/buffer.c | |
parent | d0112693a3f442a6638114f1a9ef896a0bc5960b (diff) | |
download | rneovim-25e20da550b0d267013ac295756bad76f5fda7ef.tar.gz rneovim-25e20da550b0d267013ac295756bad76f5fda7ef.tar.bz2 rneovim-25e20da550b0d267013ac295756bad76f5fda7ef.zip |
feat(buffer_updates): allow ignoring when previewing
Also adds a test that we actually subscribe to buffer events when in
CMDPREVIEW.
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index db37e2100d..45545d24d9 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -121,6 +121,8 @@ Integer nvim_buf_line_count(Buffer buffer, Error *err) /// - buffer handle /// - utf_sizes: include UTF-32 and UTF-16 size of the replaced /// region, as args to `on_lines`. +/// - preview: also attach to command preview (i.e. 'inccommand') +/// events. /// @param[out] err Error details, if any /// @return False if attach failed (invalid parameter, or buffer isn't loaded); /// otherwise True. TODO: LUA_API_NO_EVAL @@ -176,6 +178,12 @@ Boolean nvim_buf_attach(uint64_t channel_id, goto error; } cb.utf_sizes = v->data.boolean; + } else if (is_lua && strequal("preview", k.data)) { + if (v->type != kObjectTypeBoolean) { + api_set_error(err, kErrorTypeValidation, "preview must be boolean"); + goto error; + } + cb.preview = v->data.boolean; } else { api_set_error(err, kErrorTypeValidation, "unexpected key: %s", k.data); goto error; |