From bc86f76c0a1d3234b749a105c9aae65f84c51320 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 29 Feb 2020 15:27:17 +0100 Subject: api/buffer: add "on_bytes" callback to nvim_buf_attach This implements byte-resolution updates of buffer changes. Note: there is no promise that the buffer state is valid inside the callback! --- src/nvim/api/buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/api/buffer.c') diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 5290011325..ab768a1aef 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -175,8 +175,7 @@ Boolean nvim_buf_attach(uint64_t channel_id, } cb.on_lines = v->data.luaref; v->data.luaref = LUA_NOREF; - } else if (is_lua && strequal("_on_bytes", k.data)) { - // NB: undocumented, untested and incomplete interface! + } else if (is_lua && strequal("on_bytes", k.data)) { if (v->type != kObjectTypeLuaRef) { api_set_error(err, kErrorTypeValidation, "callback is not a function"); goto error; @@ -1796,6 +1795,7 @@ Dictionary nvim__buf_stats(Buffer buffer, Error *err) // NB: this should be zero at any time API functions are called, // this exists to debug issues PUT(rv, "dirty_bytes", INTEGER_OBJ((Integer)buf->deleted_bytes)); + PUT(rv, "dirty_bytes2", INTEGER_OBJ((Integer)buf->deleted_bytes2)); u_header_T *uhp = NULL; if (buf->b_u_curhead != NULL) { -- cgit