diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-07-15 18:23:11 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-08-06 17:01:47 +0200 |
commit | b0e26199ec02c9b392af6161522004c55db0441f (patch) | |
tree | c57e4cbd58018b8bf7e396239604b6e3e4943dfc /src/nvim/buffer_updates.c | |
parent | 067a39ba854cc02a750911ead968a744b2769aac (diff) | |
download | rneovim-b0e26199ec02c9b392af6161522004c55db0441f.tar.gz rneovim-b0e26199ec02c9b392af6161522004c55db0441f.tar.bz2 rneovim-b0e26199ec02c9b392af6161522004c55db0441f.zip |
lua: add {old_byte_size} to on_lines buffer change event
Diffstat (limited to 'src/nvim/buffer_updates.c')
-rw-r--r-- | src/nvim/buffer_updates.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c index 21efda9fd9..7dea8bfac5 100644 --- a/src/nvim/buffer_updates.c +++ b/src/nvim/buffer_updates.c @@ -169,6 +169,8 @@ void buf_updates_send_changes(buf_T *buf, int64_t num_removed, bool send_tick) { + size_t deleted_bytes = ml_flush_deleted_bytes(buf); + if (!buf_updates_active(buf)) { return; } @@ -231,8 +233,8 @@ void buf_updates_send_changes(buf_T *buf, bool keep = true; if (cb.on_lines != LUA_NOREF) { Array args = ARRAY_DICT_INIT; - Object items[5]; - args.size = 5; + Object items[6]; + args.size = 6; args.items = items; // the first argument is always the buffer handle @@ -250,6 +252,8 @@ void buf_updates_send_changes(buf_T *buf, // the last line in the updated range args.items[4] = INTEGER_OBJ(firstline - 1 + num_added); + // byte count of previous contents + args.items[5] = INTEGER_OBJ((Integer)deleted_bytes); textlock++; Object res = executor_exec_lua_cb(cb.on_lines, "lines", args, true); textlock--; |