mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
The grand renaming
This commit is contained in:
@@ -142,7 +142,7 @@ set(CONV_SOURCES
|
||||
message.c
|
||||
regexp.c
|
||||
screen.c
|
||||
liveupdate.c
|
||||
buffer_updates.c
|
||||
search.c
|
||||
spell.c
|
||||
spellfile.c
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/undo.h"
|
||||
#include "nvim/ex_docmd.h"
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/buffer.c.generated.h"
|
||||
@@ -76,18 +76,18 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Activate live updates from this buffer to the current channel.
|
||||
/// Activate updates from this buffer to the current channel.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param send_buffer Set to true if the initial notification should contain
|
||||
/// the whole buffer
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return False when live updates couldn't be enabled because the buffer isn't
|
||||
/// @return False when updates couldn't be enabled because the buffer isn't
|
||||
/// loaded; otherwise True.
|
||||
Boolean nvim_buf_live_updates_start(uint64_t channel_id,
|
||||
Buffer buffer,
|
||||
Boolean send_buffer,
|
||||
Error *err)
|
||||
Boolean nvim_buf_attach(uint64_t channel_id,
|
||||
Buffer buffer,
|
||||
Boolean send_buffer,
|
||||
Error *err)
|
||||
FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -96,18 +96,18 @@ Boolean nvim_buf_live_updates_start(uint64_t channel_id,
|
||||
return false;
|
||||
}
|
||||
|
||||
return liveupdate_register(buf, channel_id, send_buffer);
|
||||
return buffer_updates_register(buf, channel_id, send_buffer);
|
||||
}
|
||||
//
|
||||
/// Deactivate live updates from this buffer to the current channel.
|
||||
/// Deactivate updates from this buffer to the current channel.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return False when live updates couldn't be disabled because the buffer
|
||||
/// @return False when updates couldn't be disabled because the buffer
|
||||
/// isn't loaded; otherwise True.
|
||||
Boolean nvim_buf_live_updates_stop(uint64_t channel_id,
|
||||
Buffer buffer,
|
||||
Error *err)
|
||||
Boolean nvim_buf_detach(uint64_t channel_id,
|
||||
Buffer buffer,
|
||||
Error *err)
|
||||
FUNC_API_SINCE(4) FUNC_API_REMOTE_ONLY
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -116,7 +116,7 @@ Boolean nvim_buf_live_updates_stop(uint64_t channel_id,
|
||||
return false;
|
||||
}
|
||||
|
||||
liveupdate_unregister(buf, channel_id);
|
||||
buffer_updates_unregister(buf, channel_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,7 @@
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/time.h"
|
||||
#include "nvim/os/input.h"
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
|
||||
typedef enum {
|
||||
kBLSUnchanged = 0,
|
||||
@@ -576,7 +576,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
||||
do_autochdir();
|
||||
|
||||
// disable live updates for the current buffer
|
||||
liveupdate_unregister_all(buf);
|
||||
buffer_updates_unregister_all(buf);
|
||||
|
||||
/*
|
||||
* Remove the buffer from the list.
|
||||
@@ -789,7 +789,7 @@ free_buffer_stuff (
|
||||
xfree(buf->b_start_fenc);
|
||||
buf->b_start_fenc = NULL;
|
||||
|
||||
liveupdate_unregister_all(buf);
|
||||
buffer_updates_unregister_all(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1741,8 +1741,8 @@ buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags)
|
||||
clrallmarks(buf); // clear marks
|
||||
fmarks_check_names(buf); // check file marks for this file
|
||||
buf->b_p_bl = (flags & BLN_LISTED) ? true : false; // init 'buflisted'
|
||||
kv_destroy(buf->liveupdate_channels);
|
||||
kv_init(buf->liveupdate_channels);
|
||||
kv_destroy(buf->update_channels);
|
||||
kv_init(buf->update_channels);
|
||||
if (!(flags & BLN_DUMMY)) {
|
||||
// Tricky: these autocommands may change the buffer list. They could also
|
||||
// split the window with re-using the one empty buffer. This may result in
|
||||
|
@@ -774,9 +774,9 @@ struct file_buffer {
|
||||
|
||||
kvec_t(BufhlLine *) b_bufhl_move_space; // temporary space for highlights
|
||||
|
||||
// array of channelids which have asked to receive live updates for this
|
||||
// array of channelids which have asked to receive updates for this
|
||||
// buffer.
|
||||
kvec_t(uint64_t) liveupdate_channels;
|
||||
kvec_t(uint64_t) update_channels;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/msgpack_rpc/channel.h"
|
||||
@@ -6,7 +6,7 @@
|
||||
// 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
|
||||
// unloaded.
|
||||
bool liveupdate_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
||||
bool buffer_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
||||
{
|
||||
// must fail if the buffer isn't loaded
|
||||
if (buf->b_ml.ml_mfp == NULL) {
|
||||
@@ -14,10 +14,10 @@ bool liveupdate_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
||||
}
|
||||
|
||||
// count how many channels are currently watching the buffer
|
||||
size_t size = kv_size(buf->liveupdate_channels);
|
||||
size_t size = kv_size(buf->update_channels);
|
||||
if (size) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (kv_A(buf->liveupdate_channels, i) == channel_id) {
|
||||
if (kv_A(buf->update_channels, i) == channel_id) {
|
||||
// buffer is already registered ... nothing to do
|
||||
return true;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ bool liveupdate_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
||||
}
|
||||
|
||||
// append the channelid to the list
|
||||
kv_push(buf->liveupdate_channels, channel_id);
|
||||
kv_push(buf->update_channels, channel_id);
|
||||
|
||||
Array linedata = ARRAY_DICT_INIT;
|
||||
if (send_buffer) {
|
||||
@@ -56,22 +56,22 @@ bool liveupdate_register(buf_T *buf, uint64_t channel_id, bool send_buffer)
|
||||
args.items[2] = ARRAY_OBJ(linedata);
|
||||
args.items[3] = BOOLEAN_OBJ(false);
|
||||
|
||||
rpc_send_event(channel_id, "LiveUpdateStart", args);
|
||||
rpc_send_event(channel_id, "nvim_buf_updates_start", args);
|
||||
return true;
|
||||
}
|
||||
|
||||
void liveupdate_send_end(buf_T *buf, uint64_t channelid)
|
||||
void buffer_updates_send_end(buf_T *buf, uint64_t channelid)
|
||||
{
|
||||
Array args = ARRAY_DICT_INIT;
|
||||
args.size = 1;
|
||||
args.items = xcalloc(sizeof(Object), args.size);
|
||||
args.items[0] = BUFFER_OBJ(buf->handle);
|
||||
rpc_send_event(channelid, "LiveUpdateEnd", args);
|
||||
rpc_send_event(channelid, "nvim_buf_updates_end", args);
|
||||
}
|
||||
|
||||
void liveupdate_unregister(buf_T *buf, uint64_t channelid)
|
||||
void buffer_updates_unregister(buf_T *buf, uint64_t channelid)
|
||||
{
|
||||
size_t size = kv_size(buf->liveupdate_channels);
|
||||
size_t size = kv_size(buf->update_channels);
|
||||
if (!size) {
|
||||
return;
|
||||
}
|
||||
@@ -81,12 +81,12 @@ void liveupdate_unregister(buf_T *buf, uint64_t channelid)
|
||||
size_t j = 0;
|
||||
size_t found = 0;
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (kv_A(buf->liveupdate_channels, i) == channelid) {
|
||||
if (kv_A(buf->update_channels, i) == channelid) {
|
||||
found++;
|
||||
} else {
|
||||
// copy item backwards into prior slot if needed
|
||||
if (i != j) {
|
||||
kv_A(buf->liveupdate_channels, j) = kv_A(buf->liveupdate_channels, i);
|
||||
kv_A(buf->update_channels, j) = kv_A(buf->update_channels, i);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
@@ -94,39 +94,39 @@ void liveupdate_unregister(buf_T *buf, uint64_t channelid)
|
||||
|
||||
if (found) {
|
||||
// remove X items from the end of the array
|
||||
buf->liveupdate_channels.size -= found;
|
||||
buf->update_channels.size -= found;
|
||||
|
||||
// make a new copy of the active array without the channelid in it
|
||||
liveupdate_send_end(buf, channelid);
|
||||
buffer_updates_send_end(buf, channelid);
|
||||
|
||||
if (found == size) {
|
||||
kv_destroy(buf->liveupdate_channels);
|
||||
kv_init(buf->liveupdate_channels);
|
||||
kv_destroy(buf->update_channels);
|
||||
kv_init(buf->update_channels);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void liveupdate_unregister_all(buf_T *buf)
|
||||
void buffer_updates_unregister_all(buf_T *buf)
|
||||
{
|
||||
size_t size = kv_size(buf->liveupdate_channels);
|
||||
size_t size = kv_size(buf->update_channels);
|
||||
if (size) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
liveupdate_send_end(buf, kv_A(buf->liveupdate_channels, i));
|
||||
buffer_updates_send_end(buf, kv_A(buf->update_channels, i));
|
||||
}
|
||||
kv_destroy(buf->liveupdate_channels);
|
||||
kv_init(buf->liveupdate_channels);
|
||||
kv_destroy(buf->update_channels);
|
||||
kv_init(buf->update_channels);
|
||||
}
|
||||
}
|
||||
|
||||
void liveupdate_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
|
||||
void buffer_updates_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
|
||||
int64_t num_removed, bool send_tick)
|
||||
{
|
||||
// if one the channels doesn't work, put its ID here so we can remove it later
|
||||
uint64_t badchannelid = 0;
|
||||
|
||||
// notify each of the active channels
|
||||
for (size_t i = 0; i < kv_size(buf->liveupdate_channels); i++) {
|
||||
uint64_t channelid = kv_A(buf->liveupdate_channels, i);
|
||||
for (size_t i = 0; i < kv_size(buf->update_channels); i++) {
|
||||
uint64_t channelid = kv_A(buf->update_channels, i);
|
||||
|
||||
// send through the changes now channel contents now
|
||||
Array args = ARRAY_DICT_INIT;
|
||||
@@ -162,9 +162,9 @@ void liveupdate_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
|
||||
}
|
||||
}
|
||||
args.items[4] = ARRAY_OBJ(linedata);
|
||||
if (!rpc_send_event(channelid, "LiveUpdate", args)) {
|
||||
if (!rpc_send_event(channelid, "nvim_buf_update", args)) {
|
||||
// We can't unregister the channel while we're iterating over the
|
||||
// liveupdate_channels array, so we remember its ID to unregister it at
|
||||
// update_channels array, so we remember its ID to unregister it at
|
||||
// the end.
|
||||
badchannelid = channelid;
|
||||
}
|
||||
@@ -175,15 +175,15 @@ void liveupdate_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
|
||||
// cleared up quickly.
|
||||
if (badchannelid != 0) {
|
||||
ELOG("Disabling live updates for dead channel %llu", badchannelid);
|
||||
liveupdate_unregister(buf, badchannelid);
|
||||
buffer_updates_unregister(buf, badchannelid);
|
||||
}
|
||||
}
|
||||
|
||||
void liveupdate_send_tick(buf_T *buf)
|
||||
void buffer_updates_send_tick(buf_T *buf)
|
||||
{
|
||||
// notify each of the active channels
|
||||
for (size_t i = 0; i < kv_size(buf->liveupdate_channels); i++) {
|
||||
uint64_t channelid = kv_A(buf->liveupdate_channels, i);
|
||||
for (size_t i = 0; i < kv_size(buf->update_channels); i++) {
|
||||
uint64_t channelid = kv_A(buf->update_channels, i);
|
||||
|
||||
// send through the changes now channel contents now
|
||||
Array args = ARRAY_DICT_INIT;
|
||||
@@ -197,6 +197,6 @@ void liveupdate_send_tick(buf_T *buf)
|
||||
args.items[1] = INTEGER_OBJ(buf->b_changedtick);
|
||||
|
||||
// don't try and clean up dead channels here
|
||||
rpc_send_event(channelid, "LiveUpdateTick", args);
|
||||
rpc_send_event(channelid, "nvim_buf_update_tick", args);
|
||||
}
|
||||
}
|
13
src/nvim/buffer_updates.h
Normal file
13
src/nvim/buffer_updates.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef BUFFER_UPDATES_H
|
||||
#define BUFFER_UPDATES_H
|
||||
|
||||
#include "nvim/buffer_defs.h"
|
||||
|
||||
bool buffer_updates_register(buf_T *buf, uint64_t channel_id, bool send_buffer);
|
||||
void buffer_updates_unregister(buf_T *buf, uint64_t channel_id);
|
||||
void buffer_updates_unregister_all(buf_T *buf);
|
||||
void buffer_updates_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
|
||||
int64_t num_removed, bool send_tick);
|
||||
void buffer_updates_send_tick(buf_T *buf);
|
||||
|
||||
#endif // NVIM_BUFFER_UPDATES_H
|
@@ -35,7 +35,7 @@
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/mbyte.h"
|
||||
@@ -833,9 +833,9 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
||||
-(last_line - dest - extra), 0L, true);
|
||||
changed_lines(last_line - num_lines + 1, 0, last_line + 1, -extra, false);
|
||||
|
||||
// send live update regarding the new lines that were added
|
||||
if (kv_size(curbuf->liveupdate_channels)) {
|
||||
liveupdate_send_changes(curbuf, dest + 1, num_lines, 0, true);
|
||||
// send update regarding the new lines that were added
|
||||
if (kv_size(curbuf->update_channels)) {
|
||||
buffer_updates_send_changes(curbuf, dest + 1, num_lines, 0, true);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -872,9 +872,9 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
|
||||
changed_lines(dest + 1, 0, line1 + num_lines, 0L, false);
|
||||
}
|
||||
|
||||
// send LiveUpdate regarding lines that were deleted
|
||||
if (kv_size(curbuf->liveupdate_channels)) {
|
||||
liveupdate_send_changes(curbuf, line1 + extra, 0, num_lines, true);
|
||||
// send nvim_buf_update regarding lines that were deleted
|
||||
if (kv_size(curbuf->update_channels)) {
|
||||
buffer_updates_send_changes(curbuf, line1 + extra, 0, num_lines, true);
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -2442,7 +2442,7 @@ int do_ecmd(
|
||||
goto theend;
|
||||
}
|
||||
u_unchanged(curbuf);
|
||||
liveupdate_unregister_all(curbuf);
|
||||
buffer_updates_unregister_all(curbuf);
|
||||
buf_freeall(curbuf, BFA_KEEP_UNDO);
|
||||
|
||||
// Tell readfile() not to clear or reload undo info.
|
||||
@@ -3170,7 +3170,7 @@ static char_u *sub_parse_flags(char_u *cmd, subflags_T *subflags,
|
||||
///
|
||||
/// @return buffer used for 'inccommand' preview
|
||||
static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
|
||||
bool send_liveupdate_changedtick)
|
||||
bool send_buffer_update_changedtick)
|
||||
{
|
||||
long i = 0;
|
||||
regmmatch_T regmatch;
|
||||
@@ -4018,11 +4018,11 @@ skip:
|
||||
i = curbuf->b_ml.ml_line_count - old_line_count;
|
||||
changed_lines(first_line, 0, last_line - i, i, false);
|
||||
|
||||
if (kv_size(curbuf->liveupdate_channels)) {
|
||||
if (kv_size(curbuf->update_channels)) {
|
||||
int64_t num_added = last_line - first_line;
|
||||
int64_t num_removed = num_added - i;
|
||||
liveupdate_send_changes(curbuf, first_line, num_added, num_removed,
|
||||
send_liveupdate_changedtick);
|
||||
buffer_updates_send_changes(curbuf, first_line, num_added, num_removed,
|
||||
send_buffer_update_changedtick);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "nvim/ex_docmd.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
@@ -746,14 +746,14 @@ deleteFold (
|
||||
if (last_lnum > 0) {
|
||||
changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L, false);
|
||||
|
||||
// send one LiveUpdate at the end
|
||||
if (kv_size(curbuf->liveupdate_channels)) {
|
||||
// send one nvim_buf_update 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
|
||||
// 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
|
||||
int64_t num_changed = last_lnum - first_lnum;
|
||||
liveupdate_send_changes(curbuf, first_lnum, num_changed,
|
||||
buffer_updates_send_changes(curbuf, first_lnum, num_changed,
|
||||
num_changed, true);
|
||||
}
|
||||
}
|
||||
@@ -1605,12 +1605,12 @@ static void foldCreateMarkers(linenr_T start, linenr_T end)
|
||||
* changed when the start marker is inserted and the end isn't. */
|
||||
changed_lines(start, (colnr_T)0, end, 0L, false);
|
||||
|
||||
if (kv_size(curbuf->liveupdate_channels)) {
|
||||
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 LiveUpdate
|
||||
// u_save() is unable to save the buffer line, but we send the nvim_buf_update
|
||||
// anyway since it won't do any harm.
|
||||
int64_t num_changed = 1 + end - start;
|
||||
liveupdate_send_changes(curbuf, start, num_changed, num_changed, true);
|
||||
buffer_updates_send_changes(curbuf, start, num_changed, num_changed, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,13 +0,0 @@
|
||||
#ifndef NVIM_LIVEUPDATE_H
|
||||
#define NVIM_LIVEUPDATE_H
|
||||
|
||||
#include "nvim/buffer_defs.h"
|
||||
|
||||
bool liveupdate_register(buf_T *buf, uint64_t channel_id, bool send_buffer);
|
||||
void liveupdate_unregister(buf_T *buf, uint64_t channel_id);
|
||||
void liveupdate_unregister_all(buf_T *buf);
|
||||
void liveupdate_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
|
||||
int64_t num_removed, bool send_tick);
|
||||
void liveupdate_send_tick(buf_T *buf);
|
||||
|
||||
#endif // NVIM_LIVEUPDATE_H
|
@@ -28,7 +28,7 @@
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/indent_c.h"
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/mbyte.h"
|
||||
@@ -1822,8 +1822,8 @@ void changed_bytes(linenr_T lnum, colnr_T col)
|
||||
changedOneline(curbuf, lnum);
|
||||
changed_common(lnum, col, lnum + 1, 0L);
|
||||
// notify any channels that are watching
|
||||
if (kv_size(curbuf->liveupdate_channels)) {
|
||||
liveupdate_send_changes(curbuf, lnum, 1, 1, true);
|
||||
if (kv_size(curbuf->update_channels)) {
|
||||
buffer_updates_send_changes(curbuf, lnum, 1, 1, true);
|
||||
}
|
||||
|
||||
/* Diff highlighting in other diff windows may need to be updated too. */
|
||||
@@ -1920,9 +1920,9 @@ changed_lines(
|
||||
colnr_T col, // column in first line with change
|
||||
linenr_T lnume, // line below last changed line
|
||||
long xtra, // number of extra lines (negative when deleting)
|
||||
bool send_liveupdate // some callers like undo/redo call changed_lines()
|
||||
bool send_update // some callers like undo/redo call changed_lines()
|
||||
// and then increment b_changedtick *again*. This flag
|
||||
// allows these callers to send the LiveUpdate events
|
||||
// allows these callers to send the nvim_buf_update events
|
||||
// after they're done modifying b_changedtick.
|
||||
)
|
||||
{
|
||||
@@ -1948,10 +1948,10 @@ changed_lines(
|
||||
|
||||
changed_common(lnum, col, lnume, xtra);
|
||||
|
||||
if (send_liveupdate && kv_size(curbuf->liveupdate_channels)) {
|
||||
if (send_update && kv_size(curbuf->update_channels)) {
|
||||
int64_t num_added = (int64_t)(lnume + xtra - lnum);
|
||||
int64_t num_removed = lnume - lnum;
|
||||
liveupdate_send_changes(curbuf, lnum, num_added, num_removed, true);
|
||||
buffer_updates_send_changes(curbuf, lnum, num_added, num_removed, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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 LiveUpdate event for a :terminal buffer
|
||||
// Note: don't send nvim_buf_update event for a :terminal buffer
|
||||
changed_lines(change_start, 0, change_end, added, false);
|
||||
term->invalid_start = INT_MAX;
|
||||
term->invalid_end = -1;
|
||||
|
@@ -92,7 +92,7 @@
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/liveupdate.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/message.h"
|
||||
@@ -1698,7 +1698,7 @@ bool u_undo_and_forget(int count)
|
||||
count = 1;
|
||||
}
|
||||
undo_undoes = true;
|
||||
// don't send a LiveUpdate for this undo is part of 'inccommand' playing with
|
||||
// don't send a nvim_buf_update for this undo is part of 'inccommand' playing with
|
||||
// buffer contents
|
||||
u_doit(count, true, false);
|
||||
|
||||
@@ -1735,7 +1735,7 @@ bool u_undo_and_forget(int count)
|
||||
}
|
||||
|
||||
/// Undo or redo, depending on `undo_undoes`, `count` times.
|
||||
static void u_doit(int startcount, bool quiet, bool send_liveupdate)
|
||||
static void u_doit(int startcount, bool quiet, bool send_update)
|
||||
{
|
||||
int count = startcount;
|
||||
|
||||
@@ -1771,7 +1771,7 @@ static void u_doit(int startcount, bool quiet, bool send_liveupdate)
|
||||
break;
|
||||
}
|
||||
|
||||
u_undoredo(true, send_liveupdate);
|
||||
u_undoredo(true, send_update);
|
||||
} else {
|
||||
if (curbuf->b_u_curhead == NULL || get_undolevel() <= 0) {
|
||||
beep_flush(); /* nothing to redo */
|
||||
@@ -1782,7 +1782,7 @@ static void u_doit(int startcount, bool quiet, bool send_liveupdate)
|
||||
break;
|
||||
}
|
||||
|
||||
u_undoredo(false, send_liveupdate);
|
||||
u_undoredo(false, send_update);
|
||||
|
||||
/* Advance for next redo. Set "newhead" when at the end of the
|
||||
* redoable changes. */
|
||||
@@ -2117,7 +2117,7 @@ void undo_time(long step, int sec, int file, int absolute)
|
||||
*
|
||||
* When "undo" is TRUE we go up in the tree, when FALSE we go down.
|
||||
*/
|
||||
static void u_undoredo(int undo, bool send_liveupdate)
|
||||
static void u_undoredo(int undo, bool send_update)
|
||||
{
|
||||
char_u **newarray = NULL;
|
||||
linenr_T oldsize;
|
||||
@@ -2245,7 +2245,7 @@ static void u_undoredo(int undo, bool send_liveupdate)
|
||||
}
|
||||
}
|
||||
|
||||
changed_lines(top + 1, 0, bot, newsize - oldsize, send_liveupdate);
|
||||
changed_lines(top + 1, 0, bot, newsize - oldsize, send_update);
|
||||
|
||||
/* set '[ and '] mark */
|
||||
if (top + 1 < curbuf->b_op_start.lnum)
|
||||
@@ -2281,10 +2281,10 @@ static void u_undoredo(int undo, bool send_liveupdate)
|
||||
}
|
||||
|
||||
// because the calls to changed()/unchanged() above will bump b_changedtick
|
||||
// again, we need to send a LiveUpdate with just the new value of
|
||||
// again, we need to send a nvim_buf_update with just the new value of
|
||||
// b:changedtick
|
||||
if (send_liveupdate && kv_size(curbuf->liveupdate_channels)) {
|
||||
liveupdate_send_tick(curbuf);
|
||||
if (send_update && kv_size(curbuf->update_channels)) {
|
||||
buffer_updates_send_tick(curbuf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user