aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/msgpack_rpc.txt32
-rw-r--r--src/nvim/buffer_updates.c2
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/fold.c4
-rw-r--r--src/nvim/misc1.c6
-rw-r--r--src/nvim/terminal.c2
-rw-r--r--src/nvim/undo.c6
-rw-r--r--test/functional/api/buffer_updates_spec.lua28
8 files changed, 44 insertions, 38 deletions
diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt
index 571a08930c..b99b876722 100644
--- a/runtime/doc/msgpack_rpc.txt
+++ b/runtime/doc/msgpack_rpc.txt
@@ -286,7 +286,7 @@ nvim_buf_lines_event[{buf}, {changedtick}, {firstline}, {lastline}, {linedata},
will be given as empty strings.
{more} is a boolean which tells you whether or not to expect more
- |nvim_buf_updates| notifications for a single buffer change (i.e. Nvim has
+ |nvim_buf_lines_event| notifications for a single buffer change (i.e. Nvim has
chunked up one event into several). Not yet used.
Note: sometimes {changedtick} will be |v:null|, which means that the buffer
@@ -295,7 +295,7 @@ nvim_buf_lines_event[{buf}, {changedtick}, {firstline}, {lastline}, {linedata},
doesn't reflect the actual buffer contents. Currently this behaviour is
only used for the |inccommand| option.
-nvim_buf_changedtick_event[{buf}, {changedtick}] *nvim_buf_changedtick*
+nvim_buf_changedtick_event[{buf}, {changedtick}] *nvim_buf_changedtick_event*
Indicates that |b:changedtick| was incremented for the buffer {buf}, but no
text was changed. This is currently only used by undo/redo.
@@ -304,7 +304,7 @@ nvim_buf_changedtick_event[{buf}, {changedtick}] *nvim_buf_changedtick*
{changedtick} is the new value of |b:changedtick| for that buffer.
-nvim_buf_updates_end[{buf}] *nvim_buf_updates_end*
+nvim_buf_detach_event[{buf}] *nvim_buf_detach_event*
Indicates that buffer updates for the nominated buffer have been disabled,
either by calling |nvim_buf_detach| or because the buffer was unloaded
@@ -326,39 +326,45 @@ the buffer contents are unloaded from memory:
*buffer-updates-examples*
Examples~
-If buffer updates are activated a new empty buffer (and sending the buffer's
+If buffer updates are activated on an empty buffer (and sending the buffer's
content on the initial notification has been requested), the following
-|nvim_buf_updates_start| event will be sent: >
+|nvim_buf_lines_event| event will be sent: >
- nvim_buf_updates_start[{buf}, [""], v:false]
+ nvim_buf_lines_event[{buf}, {changedtick}, 0, 0, [""], v:false]
If the user adds 2 new lines to the start of a buffer, the following event
would be generated: >
- nvim_buf_update[{buf}, 0, 0, ["line1", "line2"]]
+ nvim_buf_lines_event[{buf}, {changedtick}, 0, 0, ["line1", "line2"], v:false]
If the puts the cursor on a line containing the text `"Hello world"` and adds
a `!` character to the end using insert mode, the following event would be
generated: >
- nvim_buf_update[{buf}, {linenr}, {linenr} + 1, ["Hello world!"]]
+ nvim_buf_lines_event[
+ {buf}, {changedtick}, {linenr}, {linenr} + 1,
+ ["Hello world!"], v:false
+ ]
If the user moves their cursor to line 3 of a buffer and deletes 20 lines
using `20dd`, the following event will be generated: >
- nvim_buf_update[{buf}, 2, 20, []]
+ nvim_buf_lines_event[{buf}, {changedtick}, 2, 22, [], v:false]
If the user selects lines 3-5 of a buffer using |linewise-visual| mode and
then presses `p` to paste in a new block of 6 lines, then the following event
would be sent to the co-process: >
- nvim_buf_update[{buf}, 2, 5, ['pasted line 1', 'pasted
- line 2', 'pasted line 3', 'pasted line 4', 'pasted line 5', 'pasted line
- 6']]
+ nvim_buf_lines_event[
+ {buf}, {changedtick}, 2, 5,
+ ['pasted line 1', 'pasted line 2', 'pasted line 3', 'pasted line 4',
+ 'pasted line 5', 'pasted line 6'],
+ v:false
+ ]
If the user uses :edit to reload a buffer then the following event would be
generated: >
- nvim_buf_updates_end[{buf}]
+ nvim_buf_detach_event[{buf}]
vim:tw=78:ts=8:ft=help:norl:
diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c
index 2852561ce0..4774b969c4 100644
--- a/src/nvim/buffer_updates.c
+++ b/src/nvim/buffer_updates.c
@@ -82,7 +82,7 @@ void buf_updates_send_end(buf_T *buf, uint64_t channelid)
args.size = 1;
args.items = xcalloc(sizeof(Object), args.size);
args.items[0] = BUFFER_OBJ(buf->handle);
- rpc_send_event(channelid, "nvim_buf_updates_end", args);
+ rpc_send_event(channelid, "nvim_buf_detach_event", args);
}
void buf_updates_unregister(buf_T *buf, uint64_t channelid)
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 0638c10dc0..1d98f171b4 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -872,7 +872,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
changed_lines(dest + 1, 0, line1 + num_lines, 0L, false);
}
- // send nvim_buf_update regarding lines that were deleted
+ // send nvim_buf_lines_event regarding lines that were deleted
if (kv_size(curbuf->update_channels)) {
buf_updates_send_changes(curbuf, line1 + extra, 0, num_lines, true);
}
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 32ba665f64..b8ace511e8 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -746,7 +746,7 @@ deleteFold (
if (last_lnum > 0) {
changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L, false);
- // send one nvim_buf_update at the end
+ // send one nvim_buf_lines_event at the end
if (kv_size(curbuf->update_channels)) {
// last_lnum is the line *after* the last line of the outermost fold
// that was modified. Note also that deleting a fold might only require
@@ -1608,7 +1608,7 @@ static void foldCreateMarkers(linenr_T start, linenr_T end)
if (kv_size(curbuf->update_channels)) {
// Note: foldAddMarker() may not actually change start and/or end if
// u_save() is unable to save the buffer line, but we send the
- // nvim_buf_update anyway since it won't do any harm.
+ // nvim_buf_lines_event anyway since it won't do any harm.
int64_t num_changed = 1 + end - start;
buf_updates_send_changes(curbuf, start, num_changed, num_changed, true);
}
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index de68031135..6c5c47b91f 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -1921,9 +1921,9 @@ changed_lines(
linenr_T lnume, // line below last changed line
long xtra, // number of extra lines (negative when deleting)
bool do_buf_event // some callers like undo/redo call changed_lines()
- // and then increment b_changedtick *again*. This flag
- // allows these callers to send the nvim_buf_update events
- // after they're done modifying b_changedtick.
+ // and then increment b_changedtick *again*. This flag
+ // allows these callers to send the nvim_buf_lines_event
+ // events after they're done modifying b_changedtick.
)
{
changed_lines_buf(curbuf, lnum, lnume, xtra);
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 9ab537d8b9..c29f0b3927 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -1234,7 +1234,7 @@ static void refresh_screen(Terminal *term, buf_T *buf)
int change_start = row_to_linenr(term, term->invalid_start);
int change_end = change_start + changed;
- // Note: don't send nvim_buf_update event for a :terminal buffer
+ // Note: don't send nvim_buf_lines_event event for a :terminal buffer
changed_lines(change_start, 0, change_end, added, false);
term->invalid_start = INT_MAX;
term->invalid_end = -1;
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 985c6873a4..44bcefb332 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1698,8 +1698,8 @@ bool u_undo_and_forget(int count)
count = 1;
}
undo_undoes = true;
- // don't send a nvim_buf_update for this undo is part of 'inccommand' playing
- // with buffer contents
+ // don't send a nvim_buf_lines_event for this undo is part of 'inccommand'
+ // playing with buffer contents
u_doit(count, true, false);
if (curbuf->b_u_curhead == NULL) {
@@ -2284,7 +2284,7 @@ static void u_undoredo(int undo, bool do_buf_event)
}
// because the calls to changed()/unchanged() above will bump b_changedtick
- // again, we need to send a nvim_buf_update with just the new value of
+ // again, we need to send a nvim_buf_lines_event with just the new value of
// b:changedtick
if (do_buf_event && kv_size(curbuf->update_channels)) {
buf_updates_changedtick(curbuf);
diff --git a/test/functional/api/buffer_updates_spec.lua b/test/functional/api/buffer_updates_spec.lua
index 1bbba91187..cb5de4e206 100644
--- a/test/functional/api/buffer_updates_spec.lua
+++ b/test/functional/api/buffer_updates_spec.lua
@@ -54,7 +54,7 @@ end
local function reopen(buf, expectedlines)
ok(buffer('detach', buf))
- expectn('nvim_buf_updates_end', {buf})
+ expectn('nvim_buf_detach_event', {buf})
-- for some reason the :edit! increments tick by 2
command('edit!')
local tick = eval('b:changedtick')
@@ -157,7 +157,7 @@ describe('buffer events', function()
-- create a new empty buffer and wipe out the old one ... this will
-- turn off live updates
command('enew!')
- expectn('nvim_buf_updates_end', {b})
+ expectn('nvim_buf_detach_event', {b})
-- add a line at the start of an empty file
command('enew')
@@ -171,7 +171,7 @@ describe('buffer events', function()
-- turn off live updates manually
buffer('detach', b2)
- expectn('nvim_buf_updates_end', {b2})
+ expectn('nvim_buf_detach_event', {b2})
-- add multiple lines to a blank file
command('enew!')
@@ -266,7 +266,7 @@ describe('buffer events', function()
-- type text into the first line of a blank file, one character at a time
command('enew!')
tick = 2
- expectn('nvim_buf_updates_end', {b})
+ expectn('nvim_buf_detach_event', {b})
local bnew = nvim('get_current_buf')
ok(buffer('attach', bnew, true))
expectn('nvim_buf_lines_event', {bnew, tick, 0, -1, {''}, false})
@@ -386,7 +386,7 @@ describe('buffer events', function()
-- reopen the file and watch live updates shut down
command('edit')
- expectn('nvim_buf_updates_end', {b})
+ expectn('nvim_buf_detach_event', {b})
end)
it('allows a channel to watch multiple buffers at once', function()
@@ -456,7 +456,7 @@ describe('buffer events', function()
ok(buffer('detach', b))
ok(buffer('detach', b))
ok(buffer('detach', b))
- expectn('nvim_buf_updates_end', {b})
+ expectn('nvim_buf_detach_event', {b})
eval('rpcnotify('..channel..', "Hello Again")')
expectn('Hello Again', {})
end)
@@ -506,7 +506,7 @@ describe('buffer events', function()
-- stop watching on channel 1
ok(request(1, 'nvim_buf_detach', b))
- wantn(1, 'nvim_buf_updates_end', {b})
+ wantn(1, 'nvim_buf_detach_event', {b})
-- undo the change to buffer 1
command('undo')
@@ -523,11 +523,11 @@ describe('buffer events', function()
eval('rpcnotify('..channel1..', "Hello")')
wantn(1, 'Hello', {})
- -- close the buffer and channels 2 and 3 should get a nvim_buf_updates_end
+ -- close the buffer and channels 2 and 3 should get a nvim_buf_detach_event
-- notification
command('edit')
- wantn(2, 'nvim_buf_updates_end', {b})
- wantn(3, 'nvim_buf_updates_end', {b})
+ wantn(2, 'nvim_buf_detach_event', {b})
+ wantn(3, 'nvim_buf_detach_event', {b})
-- make sure there are no other pending nvim_buf_lines_event messages going to
-- channel 1
@@ -671,7 +671,7 @@ describe('buffer events', function()
-- close our buffer by creating a new one
command('enew')
- expectn('nvim_buf_updates_end', {b})
+ expectn('nvim_buf_detach_event', {b})
-- reopen the original buffer, make sure there are no Live Updates sent
command('b1')
@@ -700,7 +700,7 @@ describe('buffer events', function()
command('set hidden')
command('enew')
- -- note that no nvim_buf_updates_end is sent
+ -- note that no nvim_buf_detach_event is sent
eval('rpcnotify('..channel..', "Hello There")')
expectn('Hello There', {})
@@ -723,9 +723,9 @@ describe('buffer events', function()
local b = open(true, {'AAA'})
-- call :bunload or whatever the command is, and then check that we
- -- receive a nvim_buf_updates_end
+ -- receive a nvim_buf_detach_event
command(cmd)
- expectn('nvim_buf_updates_end', {b})
+ expectn('nvim_buf_detach_event', {b})
end
end)