aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer_defs.h
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-08-06 20:25:46 +0200
committerGitHub <noreply@github.com>2019-08-06 20:25:46 +0200
commit6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5 (patch)
treeb696890d92c317c8c1bdee8781667edec02f649e /src/nvim/buffer_defs.h
parentdc1359bf8ed3afae99cceb2ee7a786d4d2b9f037 (diff)
parentc0993ed3433ef4111a39e59642d15b15261e8b68 (diff)
downloadrneovim-6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5.tar.gz
rneovim-6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5.tar.bz2
rneovim-6fb0020df4eb799004c4a13bcf3326c4b1cf3fe5.zip
Merge pull request #10513 from bfredl/bytecount
api/lua: add {byte_count} parameter to line region change event
Diffstat (limited to 'src/nvim/buffer_defs.h')
-rw-r--r--src/nvim/buffer_defs.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 143737b478..b11eaefdd0 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -459,8 +459,9 @@ typedef struct {
LuaRef on_lines;
LuaRef on_changedtick;
LuaRef on_detach;
+ bool utf_sizes;
} BufUpdateCallbacks;
-#define BUF_UPDATE_CALLBACKS_INIT { LUA_NOREF, LUA_NOREF, LUA_NOREF }
+#define BUF_UPDATE_CALLBACKS_INIT { LUA_NOREF, LUA_NOREF, LUA_NOREF, false }
#define BUF_HAS_QF_ENTRY 1
#define BUF_HAS_LL_ENTRY 2
@@ -802,11 +803,26 @@ struct file_buffer {
kvec_t(BufhlLine *) b_bufhl_move_space; // temporary space for highlights
- // array of channelids which have asked to receive updates for this
+ // array of channel_id:s which have asked to receive updates for this
// buffer.
kvec_t(uint64_t) update_channels;
+ // array of lua callbacks for buffer updates.
kvec_t(BufUpdateCallbacks) update_callbacks;
+ // whether an update callback has requested codepoint size of deleted regions.
+ bool update_need_codepoints;
+
+ // Measurements of the deleted or replaced region since the last update
+ // event. Some consumers of buffer changes need to know the byte size (like
+ // tree-sitter) or the corresponding UTF-32/UTF-16 size (like LSP) of the
+ // deleted text.
+ size_t deleted_bytes;
+ size_t deleted_codepoints;
+ size_t deleted_codeunits;
+
+ // The number for times the current line has been flushed in the memline.
+ int flush_count;
+
int b_diff_failed; // internal diff failed for this buffer
};