mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Some renamings and doc changes
This commit is contained in:
parent
de5d1e863c
commit
e7451f8a91
@ -255,16 +255,16 @@ The co-process will start receiving the following notification events:
|
|||||||
|
|
||||||
nvim_buf_updates_start[{buf}, {changedtick}, {linedata}, {more}] *nvim_buf_updates_start*
|
nvim_buf_updates_start[{buf}, {changedtick}, {linedata}, {more}] *nvim_buf_updates_start*
|
||||||
|
|
||||||
Neovim will send at least one of these notifications to confirm that
|
Nvim will send at least one of these notifications to confirm that buffer
|
||||||
buffer updates are registered for this plugin, and possibly send the buffer's
|
updates are registered for this plugin, and possibly send the buffer's
|
||||||
contents. If the buffer is very large, neovim might send the contents through
|
contents. If the buffer is very large, nvim might send the contents
|
||||||
in multiple events to avoid loading the entire buffer's contents into
|
through in multiple events to avoid loading the entire buffer's contents
|
||||||
memory at once.
|
into memory at once.
|
||||||
|
|
||||||
{buf} is an API handle for the buffer.
|
{buf} is an API handle for the buffer.
|
||||||
|
|
||||||
{changedtick} is the value of |b:changedtick| for the buffer. If you
|
{changedtick} is the value of |b:changedtick| for the buffer. If you
|
||||||
send an API command back to neovim you can check the value of
|
send an API command back to nvim you can check the value of
|
||||||
|b:changedtick| as part of your request to ensure that no other
|
|b:changedtick| as part of your request to ensure that no other
|
||||||
changes have been made.
|
changes have been made.
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ nvim_buf_updates_start[{buf}, {changedtick}, {linedata}, {more}] *nvim_buf_upda
|
|||||||
will be empty.
|
will be empty.
|
||||||
|
|
||||||
{linedata} will always have at least 1 item, but the maximum length is
|
{linedata} will always have at least 1 item, but the maximum length is
|
||||||
determined by neovim and not guaranteed to be any particular size. Also the
|
determined by nvim and not guaranteed to be any particular size. Also the
|
||||||
number of {linedata} items may vary between notifications, so your plugin
|
number of {linedata} items may vary between notifications, so your plugin
|
||||||
must be prepared to receive the line data in whatever size lists neovim
|
must be prepared to receive the line data in whatever size lists nvim
|
||||||
decides to split it into.
|
decides to split it into.
|
||||||
|
|
||||||
{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
|
||||||
@ -298,7 +298,7 @@ nvim_buf_update[{buf}, {changedtick}, {firstline}, {lastline}, {linedata}] *nvim
|
|||||||
{buf} is an API handle for the buffer.
|
{buf} is an API handle for the buffer.
|
||||||
|
|
||||||
{changedtick} is the value of |b:changedtick| for the buffer. If you send an
|
{changedtick} is the value of |b:changedtick| for the buffer. If you send an
|
||||||
API command back to neovim you can check the value of |b:changedtick| as
|
API command back to nvim you can check the value of |b:changedtick| as
|
||||||
part of your request to ensure that no other changes have been made.
|
part of your request to ensure that no other changes have been made.
|
||||||
|
|
||||||
{firstline} is the integer line number of the first line that was replaced.
|
{firstline} is the integer line number of the first line that was replaced.
|
||||||
@ -324,7 +324,7 @@ nvim_buf_update[{buf}, {changedtick}, {firstline}, {lastline}, {linedata}] *nvim
|
|||||||
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_update_tick[{buf}, {changedtick}] *nvim_buf_update_tick*
|
nvim_buf_changedtick[{buf}, {changedtick}] *nvim_buf_changedtick*
|
||||||
|
|
||||||
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.
|
||||||
@ -349,7 +349,7 @@ the buffer contents are unloaded from memory:
|
|||||||
|
|
||||||
- Closing all a buffer's windows (unless 'hidden' is enabled).
|
- Closing all a buffer's windows (unless 'hidden' is enabled).
|
||||||
- Using |:edit| to reload the buffer
|
- Using |:edit| to reload the buffer
|
||||||
- reloading the buffer after it is changed from outside neovim.
|
- reloading the buffer after it is changed from outside nvim.
|
||||||
|
|
||||||
*buffer-updates-examples*
|
*buffer-updates-examples*
|
||||||
Examples~
|
Examples~
|
||||||
|
@ -96,7 +96,7 @@ Boolean nvim_buf_attach(uint64_t channel_id,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer_updates_register(buf, channel_id, send_buffer);
|
return buf_updates_register(buf, channel_id, send_buffer);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
/// Deactivate updates from this buffer to the current channel.
|
/// Deactivate updates from this buffer to the current channel.
|
||||||
@ -116,7 +116,7 @@ Boolean nvim_buf_detach(uint64_t channel_id,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_updates_unregister(buf, channel_id);
|
buf_updates_unregister(buf, channel_id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
|||||||
do_autochdir();
|
do_autochdir();
|
||||||
|
|
||||||
// disable live updates for the current buffer
|
// disable live updates for the current buffer
|
||||||
buffer_updates_unregister_all(buf);
|
buf_updates_unregister_all(buf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the buffer from the list.
|
* Remove the buffer from the list.
|
||||||
@ -789,7 +789,7 @@ free_buffer_stuff (
|
|||||||
xfree(buf->b_start_fenc);
|
xfree(buf->b_start_fenc);
|
||||||
buf->b_start_fenc = NULL;
|
buf->b_start_fenc = NULL;
|
||||||
|
|
||||||
buffer_updates_unregister_all(buf);
|
buf_updates_unregister_all(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
// Register a channel. Return True if the channel was added, or already added.
|
// Register a channel. Return True if the channel was added, or already added.
|
||||||
// Return False if the channel couldn't be added because the buffer is
|
// Return False if the channel couldn't be added because the buffer is
|
||||||
// unloaded.
|
// unloaded.
|
||||||
bool buffer_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
bool buf_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
||||||
{
|
{
|
||||||
// must fail if the buffer isn't loaded
|
// must fail if the buffer isn't loaded
|
||||||
if (buf->b_ml.ml_mfp == NULL) {
|
if (buf->b_ml.ml_mfp == NULL) {
|
||||||
@ -64,7 +64,7 @@ bool buffer_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_updates_send_end(buf_T *buf, uint64_t channelid)
|
void buf_updates_send_end(buf_T *buf, uint64_t channelid)
|
||||||
{
|
{
|
||||||
Array args = ARRAY_DICT_INIT;
|
Array args = ARRAY_DICT_INIT;
|
||||||
args.size = 1;
|
args.size = 1;
|
||||||
@ -73,7 +73,7 @@ void buffer_updates_send_end(buf_T *buf, uint64_t channelid)
|
|||||||
rpc_send_event(channelid, "nvim_buf_updates_end", args);
|
rpc_send_event(channelid, "nvim_buf_updates_end", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_updates_unregister(buf_T *buf, uint64_t channelid)
|
void buf_updates_unregister(buf_T *buf, uint64_t channelid)
|
||||||
{
|
{
|
||||||
size_t size = kv_size(buf->update_channels);
|
size_t size = kv_size(buf->update_channels);
|
||||||
if (!size) {
|
if (!size) {
|
||||||
@ -101,7 +101,7 @@ void buffer_updates_unregister(buf_T *buf, uint64_t channelid)
|
|||||||
buf->update_channels.size -= found;
|
buf->update_channels.size -= found;
|
||||||
|
|
||||||
// make a new copy of the active array without the channelid in it
|
// make a new copy of the active array without the channelid in it
|
||||||
buffer_updates_send_end(buf, channelid);
|
buf_updates_send_end(buf, channelid);
|
||||||
|
|
||||||
if (found == size) {
|
if (found == size) {
|
||||||
kv_destroy(buf->update_channels);
|
kv_destroy(buf->update_channels);
|
||||||
@ -110,19 +110,19 @@ void buffer_updates_unregister(buf_T *buf, uint64_t channelid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_updates_unregister_all(buf_T *buf)
|
void buf_updates_unregister_all(buf_T *buf)
|
||||||
{
|
{
|
||||||
size_t size = kv_size(buf->update_channels);
|
size_t size = kv_size(buf->update_channels);
|
||||||
if (size) {
|
if (size) {
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
buffer_updates_send_end(buf, kv_A(buf->update_channels, i));
|
buf_updates_send_end(buf, kv_A(buf->update_channels, i));
|
||||||
}
|
}
|
||||||
kv_destroy(buf->update_channels);
|
kv_destroy(buf->update_channels);
|
||||||
kv_init(buf->update_channels);
|
kv_init(buf->update_channels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_updates_send_changes(buf_T *buf,
|
void buf_updates_send_changes(buf_T *buf,
|
||||||
linenr_T firstline,
|
linenr_T firstline,
|
||||||
int64_t num_added,
|
int64_t num_added,
|
||||||
int64_t num_removed,
|
int64_t num_removed,
|
||||||
@ -187,11 +187,11 @@ void buffer_updates_send_changes(buf_T *buf,
|
|||||||
// cleared up quickly.
|
// cleared up quickly.
|
||||||
if (badchannelid != 0) {
|
if (badchannelid != 0) {
|
||||||
ELOG("Disabling live updates for dead channel %llu", badchannelid);
|
ELOG("Disabling live updates for dead channel %llu", badchannelid);
|
||||||
buffer_updates_unregister(buf, badchannelid);
|
buf_updates_unregister(buf, badchannelid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void buffer_updates_send_tick(buf_T *buf)
|
void buf_updates_changedtick(buf_T *buf)
|
||||||
{
|
{
|
||||||
// notify each of the active channels
|
// notify each of the active channels
|
||||||
for (size_t i = 0; i < kv_size(buf->update_channels); i++) {
|
for (size_t i = 0; i < kv_size(buf->update_channels); i++) {
|
||||||
@ -209,6 +209,6 @@ void buffer_updates_send_tick(buf_T *buf)
|
|||||||
args.items[1] = INTEGER_OBJ(buf->b_changedtick);
|
args.items[1] = INTEGER_OBJ(buf->b_changedtick);
|
||||||
|
|
||||||
// don't try and clean up dead channels here
|
// don't try and clean up dead channels here
|
||||||
rpc_send_event(channelid, "nvim_buf_update_tick", args);
|
rpc_send_event(channelid, "nvim_buf_changedtick", args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
#include "nvim/buffer_defs.h"
|
#include "nvim/buffer_defs.h"
|
||||||
|
|
||||||
bool buffer_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer);
|
bool buf_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer);
|
||||||
void buffer_updates_unregister(buf_T *buf, uint64_t channel_id);
|
void buf_updates_unregister(buf_T *buf, uint64_t channel_id);
|
||||||
void buffer_updates_unregister_all(buf_T *buf);
|
void buf_updates_unregister_all(buf_T *buf);
|
||||||
void buffer_updates_send_changes(buf_T *buf,
|
void buf_updates_send_changes(buf_T *buf,
|
||||||
linenr_T firstline,
|
linenr_T firstline,
|
||||||
int64_t num_added,
|
int64_t num_added,
|
||||||
int64_t num_removed,
|
int64_t num_removed,
|
||||||
bool send_tick);
|
bool send_tick);
|
||||||
void buffer_updates_send_tick(buf_T *buf);
|
void buf_updates_changedtick(buf_T *buf);
|
||||||
|
|
||||||
#endif // NVIM_BUFFER_UPDATES_H
|
#endif // NVIM_BUFFER_UPDATES_H
|
||||||
|
@ -835,7 +835,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
|||||||
|
|
||||||
// send update regarding the new lines that were added
|
// send update regarding the new lines that were added
|
||||||
if (kv_size(curbuf->update_channels)) {
|
if (kv_size(curbuf->update_channels)) {
|
||||||
buffer_updates_send_changes(curbuf, dest + 1, num_lines, 0, true);
|
buf_updates_send_changes(curbuf, dest + 1, num_lines, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -874,7 +874,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
|||||||
|
|
||||||
// send nvim_buf_update regarding lines that were deleted
|
// send nvim_buf_update regarding lines that were deleted
|
||||||
if (kv_size(curbuf->update_channels)) {
|
if (kv_size(curbuf->update_channels)) {
|
||||||
buffer_updates_send_changes(curbuf, line1 + extra, 0, num_lines, true);
|
buf_updates_send_changes(curbuf, line1 + extra, 0, num_lines, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@ -2442,7 +2442,7 @@ int do_ecmd(
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
u_unchanged(curbuf);
|
u_unchanged(curbuf);
|
||||||
buffer_updates_unregister_all(curbuf);
|
buf_updates_unregister_all(curbuf);
|
||||||
buf_freeall(curbuf, BFA_KEEP_UNDO);
|
buf_freeall(curbuf, BFA_KEEP_UNDO);
|
||||||
|
|
||||||
// Tell readfile() not to clear or reload undo info.
|
// Tell readfile() not to clear or reload undo info.
|
||||||
@ -3168,9 +3168,10 @@ static char_u *sub_parse_flags(char_u *cmd, subflags_T *subflags,
|
|||||||
///
|
///
|
||||||
/// The usual escapes are supported as described in the regexp docs.
|
/// The usual escapes are supported as described in the regexp docs.
|
||||||
///
|
///
|
||||||
|
/// @param do_buf_event If `true`, send buffer updates.
|
||||||
/// @return buffer used for 'inccommand' preview
|
/// @return buffer used for 'inccommand' preview
|
||||||
static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
||||||
bool send_buffer_update_changedtick)
|
bool do_buf_event)
|
||||||
{
|
{
|
||||||
long i = 0;
|
long i = 0;
|
||||||
regmmatch_T regmatch;
|
regmmatch_T regmatch;
|
||||||
@ -4021,8 +4022,8 @@ skip:
|
|||||||
if (kv_size(curbuf->update_channels)) {
|
if (kv_size(curbuf->update_channels)) {
|
||||||
int64_t num_added = last_line - first_line;
|
int64_t num_added = last_line - first_line;
|
||||||
int64_t num_removed = num_added - i;
|
int64_t num_removed = num_added - i;
|
||||||
buffer_updates_send_changes(curbuf, first_line, num_added, num_removed,
|
buf_updates_send_changes(curbuf, first_line, num_added, num_removed,
|
||||||
send_buffer_update_changedtick);
|
do_buf_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,7 +753,7 @@ deleteFold (
|
|||||||
// the modification of the *first* line of the fold, but we send through a
|
// the modification of the *first* line of the fold, but we send through a
|
||||||
// notification that includes every line that was part of the fold
|
// notification that includes every line that was part of the fold
|
||||||
int64_t num_changed = last_lnum - first_lnum;
|
int64_t num_changed = last_lnum - first_lnum;
|
||||||
buffer_updates_send_changes(curbuf, first_lnum, num_changed,
|
buf_updates_send_changes(curbuf, first_lnum, num_changed,
|
||||||
num_changed, true);
|
num_changed, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1610,7 +1610,7 @@ static void foldCreateMarkers(linenr_T start, linenr_T end)
|
|||||||
// 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_update anyway since it won't do any harm.
|
||||||
int64_t num_changed = 1 + end - start;
|
int64_t num_changed = 1 + end - start;
|
||||||
buffer_updates_send_changes(curbuf, start, num_changed, num_changed, true);
|
buf_updates_send_changes(curbuf, start, num_changed, num_changed, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1823,7 +1823,7 @@ void changed_bytes(linenr_T lnum, colnr_T col)
|
|||||||
changed_common(lnum, col, lnum + 1, 0L);
|
changed_common(lnum, col, lnum + 1, 0L);
|
||||||
// notify any channels that are watching
|
// notify any channels that are watching
|
||||||
if (kv_size(curbuf->update_channels)) {
|
if (kv_size(curbuf->update_channels)) {
|
||||||
buffer_updates_send_changes(curbuf, lnum, 1, 1, true);
|
buf_updates_send_changes(curbuf, lnum, 1, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Diff highlighting in other diff windows may need to be updated too. */
|
/* Diff highlighting in other diff windows may need to be updated too. */
|
||||||
@ -1920,7 +1920,7 @@ changed_lines(
|
|||||||
colnr_T col, // column in first line with change
|
colnr_T col, // column in first line with change
|
||||||
linenr_T lnume, // line below last changed line
|
linenr_T lnume, // line below last changed line
|
||||||
long xtra, // number of extra lines (negative when deleting)
|
long xtra, // number of extra lines (negative when deleting)
|
||||||
bool send_update // 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_update events
|
||||||
// after they're done modifying b_changedtick.
|
// after they're done modifying b_changedtick.
|
||||||
@ -1948,10 +1948,10 @@ changed_lines(
|
|||||||
|
|
||||||
changed_common(lnum, col, lnume, xtra);
|
changed_common(lnum, col, lnume, xtra);
|
||||||
|
|
||||||
if (send_update && kv_size(curbuf->update_channels)) {
|
if (do_buf_event && kv_size(curbuf->update_channels)) {
|
||||||
int64_t num_added = (int64_t)(lnume + xtra - lnum);
|
int64_t num_added = (int64_t)(lnume + xtra - lnum);
|
||||||
int64_t num_removed = lnume - lnum;
|
int64_t num_removed = lnume - lnum;
|
||||||
buffer_updates_send_changes(curbuf, lnum, num_added, num_removed, true);
|
buf_updates_send_changes(curbuf, lnum, num_added, num_removed, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1735,7 +1735,11 @@ bool u_undo_and_forget(int count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Undo or redo, depending on `undo_undoes`, `count` times.
|
/// Undo or redo, depending on `undo_undoes`, `count` times.
|
||||||
static void u_doit(int startcount, bool quiet, bool send_update)
|
///
|
||||||
|
/// @param startcount How often to undo or redo
|
||||||
|
/// @param quiet If `true`, don't show messages
|
||||||
|
/// @param do_buf_event If `true`, send the changedtick with the buffer updates
|
||||||
|
static void u_doit(int startcount, bool quiet, bool do_buf_event)
|
||||||
{
|
{
|
||||||
int count = startcount;
|
int count = startcount;
|
||||||
|
|
||||||
@ -1771,7 +1775,7 @@ static void u_doit(int startcount, bool quiet, bool send_update)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_undoredo(true, send_update);
|
u_undoredo(true, do_buf_event);
|
||||||
} else {
|
} else {
|
||||||
if (curbuf->b_u_curhead == NULL || get_undolevel() <= 0) {
|
if (curbuf->b_u_curhead == NULL || get_undolevel() <= 0) {
|
||||||
beep_flush(); /* nothing to redo */
|
beep_flush(); /* nothing to redo */
|
||||||
@ -1782,7 +1786,7 @@ static void u_doit(int startcount, bool quiet, bool send_update)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_undoredo(false, send_update);
|
u_undoredo(false, do_buf_event);
|
||||||
|
|
||||||
/* Advance for next redo. Set "newhead" when at the end of the
|
/* Advance for next redo. Set "newhead" when at the end of the
|
||||||
* redoable changes. */
|
* redoable changes. */
|
||||||
@ -2108,16 +2112,15 @@ void undo_time(long step, int sec, int file, int absolute)
|
|||||||
u_undo_end(did_undo, absolute, false);
|
u_undo_end(did_undo, absolute, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// u_undoredo: common code for undo and redo
|
||||||
* u_undoredo: common code for undo and redo
|
///
|
||||||
*
|
/// The lines in the file are replaced by the lines in the entry list at
|
||||||
* The lines in the file are replaced by the lines in the entry list at
|
/// curbuf->b_u_curhead. The replaced lines in the file are saved in the entry
|
||||||
* curbuf->b_u_curhead. The replaced lines in the file are saved in the entry
|
/// list for the next undo/redo.
|
||||||
* list for the next undo/redo.
|
///
|
||||||
*
|
/// @param undo If `true`, go up the tree. Down if `false`.
|
||||||
* When "undo" is TRUE we go up in the tree, when FALSE we go down.
|
/// @param do_buf_event If `true`, send buffer updates.
|
||||||
*/
|
static void u_undoredo(int undo, bool do_buf_event)
|
||||||
static void u_undoredo(int undo, bool send_update)
|
|
||||||
{
|
{
|
||||||
char_u **newarray = NULL;
|
char_u **newarray = NULL;
|
||||||
linenr_T oldsize;
|
linenr_T oldsize;
|
||||||
@ -2245,7 +2248,7 @@ static void u_undoredo(int undo, bool send_update)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changed_lines(top + 1, 0, bot, newsize - oldsize, send_update);
|
changed_lines(top + 1, 0, bot, newsize - oldsize, do_buf_event);
|
||||||
|
|
||||||
/* set '[ and '] mark */
|
/* set '[ and '] mark */
|
||||||
if (top + 1 < curbuf->b_op_start.lnum)
|
if (top + 1 < curbuf->b_op_start.lnum)
|
||||||
@ -2283,8 +2286,8 @@ static void u_undoredo(int undo, bool send_update)
|
|||||||
// 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_update with just the new value of
|
||||||
// b:changedtick
|
// b:changedtick
|
||||||
if (send_update && kv_size(curbuf->update_channels)) {
|
if (do_buf_event && kv_size(curbuf->update_channels)) {
|
||||||
buffer_updates_send_tick(curbuf);
|
buf_updates_changedtick(curbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -336,7 +336,7 @@ describe('liveupdate', function()
|
|||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update', {b, tick, 1, 2, {}})
|
expectn('nvim_buf_update', {b, tick, 1, 2, {}})
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update_tick', {b, tick})
|
expectn('nvim_buf_changedtick', {b, tick})
|
||||||
command('set autoindent')
|
command('set autoindent')
|
||||||
command('normal! >>')
|
command('normal! >>')
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
@ -354,7 +354,7 @@ describe('liveupdate', function()
|
|||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update', {b, tick, 1, 2, {}})
|
expectn('nvim_buf_update', {b, tick, 1, 2, {}})
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update_tick', {b, tick})
|
expectn('nvim_buf_changedtick', {b, tick})
|
||||||
command('normal! ggOmmm')
|
command('normal! ggOmmm')
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update', {b, tick, 0, 0, {"\t"}})
|
expectn('nvim_buf_update', {b, tick, 0, 0, {"\t"}})
|
||||||
@ -374,7 +374,7 @@ describe('liveupdate', function()
|
|||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update', {b, tick, 0, 1, {'Line 1'}})
|
expectn('nvim_buf_update', {b, tick, 0, 1, {'Line 1'}})
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update_tick', {b, tick})
|
expectn('nvim_buf_changedtick', {b, tick})
|
||||||
|
|
||||||
-- change the file directly
|
-- change the file directly
|
||||||
local f = io.open(filename, 'a')
|
local f = io.open(filename, 'a')
|
||||||
@ -410,7 +410,7 @@ describe('liveupdate', function()
|
|||||||
tick1 = tick1 + 1
|
tick1 = tick1 + 1
|
||||||
expectn('nvim_buf_update', {b1, tick1, 0, 1, {'A1'}})
|
expectn('nvim_buf_update', {b1, tick1, 0, 1, {'A1'}})
|
||||||
tick1 = tick1 + 1
|
tick1 = tick1 + 1
|
||||||
expectn('nvim_buf_update_tick', {b1, tick1})
|
expectn('nvim_buf_changedtick', {b1, tick1})
|
||||||
|
|
||||||
command('b'..b2nr)
|
command('b'..b2nr)
|
||||||
command('normal! x')
|
command('normal! x')
|
||||||
@ -420,7 +420,7 @@ describe('liveupdate', function()
|
|||||||
tick2 = tick2 + 1
|
tick2 = tick2 + 1
|
||||||
expectn('nvim_buf_update', {b2, tick2, 0, 1, {'B1'}})
|
expectn('nvim_buf_update', {b2, tick2, 0, 1, {'B1'}})
|
||||||
tick2 = tick2 + 1
|
tick2 = tick2 + 1
|
||||||
expectn('nvim_buf_update_tick', {b2, tick2})
|
expectn('nvim_buf_changedtick', {b2, tick2})
|
||||||
|
|
||||||
command('b'..b3nr)
|
command('b'..b3nr)
|
||||||
command('normal! x')
|
command('normal! x')
|
||||||
@ -430,7 +430,7 @@ describe('liveupdate', function()
|
|||||||
tick3 = tick3 + 1
|
tick3 = tick3 + 1
|
||||||
expectn('nvim_buf_update', {b3, tick3, 0, 1, {'C1'}})
|
expectn('nvim_buf_update', {b3, tick3, 0, 1, {'C1'}})
|
||||||
tick3 = tick3 + 1
|
tick3 = tick3 + 1
|
||||||
expectn('nvim_buf_update_tick', {b3, tick3})
|
expectn('nvim_buf_changedtick', {b3, tick3})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('doesn\'t get confused when you turn watching on/off many times',
|
it('doesn\'t get confused when you turn watching on/off many times',
|
||||||
@ -512,8 +512,8 @@ describe('liveupdate', function()
|
|||||||
wantn(2, 'nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
wantn(2, 'nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
||||||
wantn(3, 'nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
wantn(3, 'nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
wantn(2, 'nvim_buf_update_tick', {b, tick})
|
wantn(2, 'nvim_buf_changedtick', {b, tick})
|
||||||
wantn(3, 'nvim_buf_update_tick', {b, tick})
|
wantn(3, 'nvim_buf_changedtick', {b, tick})
|
||||||
|
|
||||||
-- make sure there are no other pending nvim_buf_update messages going to
|
-- make sure there are no other pending nvim_buf_update messages going to
|
||||||
-- channel 1
|
-- channel 1
|
||||||
@ -665,7 +665,7 @@ describe('liveupdate', function()
|
|||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
expectn('nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update_tick', {b, tick})
|
expectn('nvim_buf_changedtick', {b, tick})
|
||||||
|
|
||||||
-- close our buffer by creating a new one
|
-- close our buffer by creating a new one
|
||||||
command('enew')
|
command('enew')
|
||||||
@ -692,7 +692,7 @@ describe('liveupdate', function()
|
|||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
expectn('nvim_buf_update', {b, tick, 0, 1, {'AAA'}})
|
||||||
tick = tick + 1
|
tick = tick + 1
|
||||||
expectn('nvim_buf_update_tick', {b, tick})
|
expectn('nvim_buf_changedtick', {b, tick})
|
||||||
|
|
||||||
-- close our buffer by creating a new one
|
-- close our buffer by creating a new one
|
||||||
command('set hidden')
|
command('set hidden')
|
||||||
|
Loading…
Reference in New Issue
Block a user