aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer_updates.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-05-31 17:44:13 +0200
committerGitHub <noreply@github.com>2022-05-31 17:44:13 +0200
commit7380ebfc17723662f6fe1e38372f54b3d67fe082 (patch)
treee079f85a72f851e5c0a8e08f52db0cb4a8b26163 /src/nvim/buffer_updates.c
parent5d840fa7e6ba7d58a89d3126ee914cb0e42168ca (diff)
parent46536f53e82967dcac8d030ee3394cdb156f9603 (diff)
downloadrneovim-7380ebfc17723662f6fe1e38372f54b3d67fe082.tar.gz
rneovim-7380ebfc17723662f6fe1e38372f54b3d67fe082.tar.bz2
rneovim-7380ebfc17723662f6fe1e38372f54b3d67fe082.zip
Merge pull request #18194 from famiu/feat/usercmd_preview
feat: user command "preview" (like inccommand)
Diffstat (limited to 'src/nvim/buffer_updates.c')
-rw-r--r--src/nvim/buffer_updates.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/buffer_updates.c b/src/nvim/buffer_updates.c
index cb08ba0cfb..47b88945c7 100644
--- a/src/nvim/buffer_updates.c
+++ b/src/nvim/buffer_updates.c
@@ -187,7 +187,7 @@ void buf_updates_unload(buf_T *buf, bool can_reload)
}
void buf_updates_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
- int64_t num_removed, bool send_tick)
+ int64_t num_removed)
{
size_t deleted_codepoints, deleted_codeunits;
size_t deleted_bytes = ml_flush_deleted_bytes(buf, &deleted_codepoints,
@@ -197,6 +197,9 @@ void buf_updates_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
return;
}
+ // Don't send b:changedtick during 'inccommand' preview if "buf" is the current buffer.
+ bool send_tick = !(cmdpreview && buf == curbuf);
+
// if one the channels doesn't work, put its ID here so we can remove it later
uint64_t badchannelid = 0;
@@ -253,7 +256,7 @@ void buf_updates_send_changes(buf_T *buf, linenr_T firstline, int64_t num_added,
for (size_t i = 0; i < kv_size(buf->update_callbacks); i++) {
BufUpdateCallbacks cb = kv_A(buf->update_callbacks, i);
bool keep = true;
- if (cb.on_lines != LUA_NOREF && (cb.preview || !(State & MODE_CMDPREVIEW))) {
+ if (cb.on_lines != LUA_NOREF && (cb.preview || !cmdpreview)) {
Array args = ARRAY_DICT_INIT;
Object items[8];
args.size = 6; // may be increased to 8 below
@@ -312,7 +315,7 @@ void buf_updates_send_splice(buf_T *buf, int start_row, colnr_T start_col, bcoun
for (size_t i = 0; i < kv_size(buf->update_callbacks); i++) {
BufUpdateCallbacks cb = kv_A(buf->update_callbacks, i);
bool keep = true;
- if (cb.on_bytes != LUA_NOREF && (cb.preview || !(State & MODE_CMDPREVIEW))) {
+ if (cb.on_bytes != LUA_NOREF && (cb.preview || !cmdpreview)) {
FIXED_TEMP_ARRAY(args, 11);
// the first argument is always the buffer handle