diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-01-14 12:45:09 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-01-16 12:36:10 +0100 |
commit | ca1a00edd6d6345b848a28d077d6a192528f811e (patch) | |
tree | 936ca7dda66f9dc5fdf0f63181e45b42cfe1016d /src/nvim/buffer_defs.h | |
parent | 55677ddc4637664c8ef034e5c91f79fae8a97396 (diff) | |
download | rneovim-ca1a00edd6d6345b848a28d077d6a192528f811e.tar.gz rneovim-ca1a00edd6d6345b848a28d077d6a192528f811e.tar.bz2 rneovim-ca1a00edd6d6345b848a28d077d6a192528f811e.zip |
extmarks/bufhl: reimplement using new marktree data structure
Add new "splice" interface for tracking buffer changes at the byte
level. This will later be reused for byte-resolution buffer updates.
(Implementation has been started, but using undocumented "_on_bytes"
option now as interface hasn't been finalized).
Use this interface to improve many edge cases of extmark adjustment.
Changed tests indicate previously incorrect behavior. Adding tests for
more edge cases will be follow-up work (overlaps on_bytes tests)
Don't consider creation/deletion of marks an undoable event by itself.
This behavior was never documented, and imposes complexity for little gain.
Add nvim__buf_add_decoration temporary API for direct access to the new
implementation. This should be refactored into a proper API for
decorations, probably involving a huge dict.
fixes #11598
Diffstat (limited to 'src/nvim/buffer_defs.h')
-rw-r--r-- | src/nvim/buffer_defs.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 265fc05f67..a0379740b6 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -42,6 +42,8 @@ typedef struct { #include "nvim/map.h" // for kvec #include "nvim/lib/kvec.h" +// for marktree +#include "nvim/marktree.h" #define GETFILE_SUCCESS(x) ((x) <= 0) #define MODIFIABLE(buf) (buf->b_p_ma) @@ -109,15 +111,10 @@ typedef uint16_t disptick_T; // display tick type #include "nvim/syntax_defs.h" // for signlist_T #include "nvim/sign_defs.h" -// for bufhl_*_T -#include "nvim/bufhl_defs.h" #include "nvim/os/fs_defs.h" // for FileID #include "nvim/terminal.h" // for Terminal -#include "nvim/lib/kbtree.h" -#include "nvim/mark_extended.h" - /* * The taggy struct is used to store the information about a :tag command. */ @@ -461,11 +458,15 @@ typedef TV_DICTITEM_STRUCT(sizeof("changedtick")) ChangedtickDictItem; typedef struct { LuaRef on_lines; + LuaRef on_bytes; LuaRef on_changedtick; LuaRef on_detach; bool utf_sizes; } BufUpdateCallbacks; -#define BUF_UPDATE_CALLBACKS_INIT { LUA_NOREF, LUA_NOREF, LUA_NOREF, false } +#define BUF_UPDATE_CALLBACKS_INIT { LUA_NOREF, LUA_NOREF, LUA_NOREF, \ + LUA_NOREF, false } + +EXTERN int curbuf_splice_pending INIT(= 0); #define BUF_HAS_QF_ENTRY 1 #define BUF_HAS_LL_ENTRY 2 @@ -804,13 +805,9 @@ struct file_buffer { int b_mapped_ctrl_c; // modes where CTRL-C is mapped - BufhlInfo b_bufhl_info; // buffer stored highlights - - kvec_t(BufhlLine *) b_bufhl_move_space; // temporary space for highlights - - PMap(uint64_t) *b_extmark_ns; // extmark namespaces - kbtree_t(extmarklines) b_extlines; // extmarks - kvec_t(ExtmarkLine *) b_extmark_move_space; // temp space for extmarks + MarkTree b_marktree[1]; + Map(uint64_t, ExtmarkItem) *b_extmark_index; + Map(uint64_t, ExtmarkNs) *b_extmark_ns; // extmark namespaces // array of channel_id:s which have asked to receive updates for this // buffer. |