aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/api.txt
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-07-15 18:23:11 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-08-06 17:01:47 +0200
commitb0e26199ec02c9b392af6161522004c55db0441f (patch)
treec57e4cbd58018b8bf7e396239604b6e3e4943dfc /runtime/doc/api.txt
parent067a39ba854cc02a750911ead968a744b2769aac (diff)
downloadrneovim-b0e26199ec02c9b392af6161522004c55db0441f.tar.gz
rneovim-b0e26199ec02c9b392af6161522004c55db0441f.tar.bz2
rneovim-b0e26199ec02c9b392af6161522004c55db0441f.zip
lua: add {old_byte_size} to on_lines buffer change event
Diffstat (limited to 'runtime/doc/api.txt')
-rw-r--r--runtime/doc/api.txt16
1 files changed, 11 insertions, 5 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 709e5885e4..f4366cb1af 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -200,17 +200,23 @@ User reloads the buffer with ":edit", emits: >
nvim_buf_detach_event[{buf}]
*api-buffer-updates-lua*
-In-process lua plugins can also recieve buffer updates, in the form of lua
+In-process lua plugins can also receive buffer updates, in the form of lua
callbacks. These callbacks are called frequently in various contexts, buffer
contents or window layout should not be changed inside these |textlock|.
|vim.schedule| can be used to defer these operations to the main loop, where
they are allowed.
|nvim_buf_attach| will take keyword args for the callbacks. "on_lines" will
-receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline}, {new_lastline}).
-Unlike remote channels the text contents are not passed. The new text can be
-accessed inside the callback as
-`vim.api.nvim_buf_get_lines(buf, firstline, new_lastline, true)`
+receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline},
+{new_lastline}, {old_bytecount}).
+Unlike remote channel events the text contents are not passed. The new text can
+be accessed inside the callback as
+
+ `vim.api.nvim_buf_get_lines(buf, firstline, new_lastline, true)`
+
+{old_bytecount} is the total size of the replaced region {firstline} to
+{lastline} in bytes, including the final newline after {lastline}.
+
"on_changedtick" is invoked when |b:changedtick| was incremented but no text
was changed. The parameters recieved are ("changedtick", {buf}, {changedtick}).