Rename some more, fixe borked renaming

This commit is contained in:
KillTheMule
2018-05-18 10:09:11 +02:00
parent 0bee3925ab
commit 65e7f6f0b9
8 changed files with 44 additions and 38 deletions

View File

@@ -286,7 +286,7 @@ nvim_buf_lines_event[{buf}, {changedtick}, {firstline}, {lastline}, {linedata},
will be given as empty strings. will be given as empty strings.
{more} is a boolean which tells you whether or not to expect more {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. chunked up one event into several). Not yet used.
Note: sometimes {changedtick} will be |v:null|, which means that the buffer 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 doesn't reflect the actual buffer contents. Currently this behaviour is
only used for the |inccommand| option. 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 Indicates that |b:changedtick| was incremented for the buffer {buf}, but no
text was changed. This is currently only used by undo/redo. 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. {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, Indicates that buffer updates for the nominated buffer have been disabled,
either by calling |nvim_buf_detach| or because the buffer was unloaded 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* *buffer-updates-examples*
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 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 If the user adds 2 new lines to the start of a buffer, the following event
would be generated: > 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 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 a `!` character to the end using insert mode, the following event would be
generated: > 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 If the user moves their cursor to line 3 of a buffer and deletes 20 lines
using `20dd`, the following event will be generated: > 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 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 then presses `p` to paste in a new block of 6 lines, then the following event
would be sent to the co-process: > would be sent to the co-process: >
nvim_buf_update[{buf}, 2, 5, ['pasted line 1', 'pasted nvim_buf_lines_event[
line 2', 'pasted line 3', 'pasted line 4', 'pasted line 5', 'pasted line {buf}, {changedtick}, 2, 5,
6']] ['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 If the user uses :edit to reload a buffer then the following event would be
generated: > generated: >
nvim_buf_updates_end[{buf}] nvim_buf_detach_event[{buf}]
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@@ -82,7 +82,7 @@ void buf_updates_send_end(buf_T *buf, uint64_t channelid)
args.size = 1; args.size = 1;
args.items = xcalloc(sizeof(Object), args.size); args.items = xcalloc(sizeof(Object), args.size);
args.items[0] = BUFFER_OBJ(buf->handle); 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) void buf_updates_unregister(buf_T *buf, uint64_t channelid)

View File

@@ -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); 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)) { if (kv_size(curbuf->update_channels)) {
buf_updates_send_changes(curbuf, line1 + extra, 0, num_lines, true); buf_updates_send_changes(curbuf, line1 + extra, 0, num_lines, true);
} }

View File

@@ -746,7 +746,7 @@ deleteFold (
if (last_lnum > 0) { if (last_lnum > 0) {
changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L, false); 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)) { if (kv_size(curbuf->update_channels)) {
// last_lnum is the line *after* the last line of the outermost fold // 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 // 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)) { if (kv_size(curbuf->update_channels)) {
// Note: foldAddMarker() may not actually change start and/or end if // Note: foldAddMarker() may not actually change start and/or end if
// u_save() is unable to save the buffer line, but we send the // 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; int64_t num_changed = 1 + end - start;
buf_updates_send_changes(curbuf, start, num_changed, num_changed, true); buf_updates_send_changes(curbuf, start, num_changed, num_changed, true);
} }

View File

@@ -1922,8 +1922,8 @@ changed_lines(
long xtra, // number of extra lines (negative when deleting) long xtra, // number of extra lines (negative when deleting)
bool do_buf_event // some callers like undo/redo call changed_lines() bool do_buf_event // some callers like undo/redo call changed_lines()
// and then increment b_changedtick *again*. This flag // and then increment b_changedtick *again*. This flag
// allows these callers to send the nvim_buf_update events // allows these callers to send the nvim_buf_lines_event
// after they're done modifying b_changedtick. // events after they're done modifying b_changedtick.
) )
{ {
changed_lines_buf(curbuf, lnum, lnume, xtra); changed_lines_buf(curbuf, lnum, lnume, xtra);

View File

@@ -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_start = row_to_linenr(term, term->invalid_start);
int change_end = change_start + changed; 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); changed_lines(change_start, 0, change_end, added, false);
term->invalid_start = INT_MAX; term->invalid_start = INT_MAX;
term->invalid_end = -1; term->invalid_end = -1;

View File

@@ -1698,8 +1698,8 @@ bool u_undo_and_forget(int count)
count = 1; count = 1;
} }
undo_undoes = true; undo_undoes = true;
// don't send a nvim_buf_update for this undo is part of 'inccommand' playing // don't send a nvim_buf_lines_event for this undo is part of 'inccommand'
// with buffer contents // playing with buffer contents
u_doit(count, true, false); u_doit(count, true, false);
if (curbuf->b_u_curhead == NULL) { 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 // 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 // b:changedtick
if (do_buf_event && kv_size(curbuf->update_channels)) { if (do_buf_event && kv_size(curbuf->update_channels)) {
buf_updates_changedtick(curbuf); buf_updates_changedtick(curbuf);

View File

@@ -54,7 +54,7 @@ end
local function reopen(buf, expectedlines) local function reopen(buf, expectedlines)
ok(buffer('detach', buf)) 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 -- for some reason the :edit! increments tick by 2
command('edit!') command('edit!')
local tick = eval('b:changedtick') 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 -- create a new empty buffer and wipe out the old one ... this will
-- turn off live updates -- turn off live updates
command('enew!') command('enew!')
expectn('nvim_buf_updates_end', {b}) expectn('nvim_buf_detach_event', {b})
-- add a line at the start of an empty file -- add a line at the start of an empty file
command('enew') command('enew')
@@ -171,7 +171,7 @@ describe('buffer events', function()
-- turn off live updates manually -- turn off live updates manually
buffer('detach', b2) buffer('detach', b2)
expectn('nvim_buf_updates_end', {b2}) expectn('nvim_buf_detach_event', {b2})
-- add multiple lines to a blank file -- add multiple lines to a blank file
command('enew!') 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 -- type text into the first line of a blank file, one character at a time
command('enew!') command('enew!')
tick = 2 tick = 2
expectn('nvim_buf_updates_end', {b}) expectn('nvim_buf_detach_event', {b})
local bnew = nvim('get_current_buf') local bnew = nvim('get_current_buf')
ok(buffer('attach', bnew, true)) ok(buffer('attach', bnew, true))
expectn('nvim_buf_lines_event', {bnew, tick, 0, -1, {''}, false}) 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 -- reopen the file and watch live updates shut down
command('edit') command('edit')
expectn('nvim_buf_updates_end', {b}) expectn('nvim_buf_detach_event', {b})
end) end)
it('allows a channel to watch multiple buffers at once', function() 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)) 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")') eval('rpcnotify('..channel..', "Hello Again")')
expectn('Hello Again', {}) expectn('Hello Again', {})
end) end)
@@ -506,7 +506,7 @@ describe('buffer events', function()
-- stop watching on channel 1 -- stop watching on channel 1
ok(request(1, 'nvim_buf_detach', b)) 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 -- undo the change to buffer 1
command('undo') command('undo')
@@ -523,11 +523,11 @@ describe('buffer events', function()
eval('rpcnotify('..channel1..', "Hello")') eval('rpcnotify('..channel1..', "Hello")')
wantn(1, '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 -- notification
command('edit') command('edit')
wantn(2, 'nvim_buf_updates_end', {b}) wantn(2, 'nvim_buf_detach_event', {b})
wantn(3, 'nvim_buf_updates_end', {b}) wantn(3, 'nvim_buf_detach_event', {b})
-- make sure there are no other pending nvim_buf_lines_event messages going to -- make sure there are no other pending nvim_buf_lines_event messages going to
-- channel 1 -- channel 1
@@ -671,7 +671,7 @@ describe('buffer events', function()
-- close our buffer by creating a new one -- close our buffer by creating a new one
command('enew') 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 -- reopen the original buffer, make sure there are no Live Updates sent
command('b1') command('b1')
@@ -700,7 +700,7 @@ describe('buffer events', function()
command('set hidden') command('set hidden')
command('enew') 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")') eval('rpcnotify('..channel..', "Hello There")')
expectn('Hello There', {}) expectn('Hello There', {})
@@ -723,9 +723,9 @@ describe('buffer events', function()
local b = open(true, {'AAA'}) local b = open(true, {'AAA'})
-- call :bunload or whatever the command is, and then check that we -- 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) command(cmd)
expectn('nvim_buf_updates_end', {b}) expectn('nvim_buf_detach_event', {b})
end end
end) end)