aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-08-06 20:25:46 +0200
committerGitHub <noreply@github.com>2019-08-06 20:25:46 +0200
commit6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5 (patch)
treeb696890d92c317c8c1bdee8781667edec02f649e /runtime
parentdc1359bf8ed3afae99cceb2ee7a786d4d2b9f037 (diff)
parentc0993ed3433ef4111a39e59642d15b15261e8b68 (diff)
downloadrneovim-6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5.tar.gz
rneovim-6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5.tar.bz2
rneovim-6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5.zip
Merge pull request #10513 from bfredl/bytecount
api/lua: add {byte_count} parameter to line region change event
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt19
1 files changed, 14 insertions, 5 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 709e5885e4..2c6b053994 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -200,17 +200,26 @@ 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_byte_size}[, {old_utf32_size}, {old_utf16_size}]).
+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_byte_size} is the total size of the replaced region {firstline} to
+{lastline} in bytes, including the final newline after {lastline}. if
+`utf_sizes` is set to true in |nvim_buf_attach()| keyword args, then the
+UTF-32 and UTF-16 sizes of the deleted region is also passed as additional
+arguments {old_utf32_size} and {old_utf16_size}.
+
"on_changedtick" is invoked when |b:changedtick| was incremented but no text
was changed. The parameters recieved are ("changedtick", {buf}, {changedtick}).