diff options
author | altermo <107814000+altermo@users.noreply.github.com> | 2024-02-06 11:52:42 +0100 |
---|---|---|
committer | altermo <107814000+altermo@users.noreply.github.com> | 2024-02-21 16:11:50 +0100 |
commit | 1c032ad703a19cd5c8498ee95f9352df87a91139 (patch) | |
tree | 9c2c79ae6dc17feb4c63687069cb1b9805fcc1bb /src/nvim/marktree.h | |
parent | 6d8bbfe19df2175637a1e47ac1aafb0e96e35b38 (diff) | |
download | rneovim-1c032ad703a19cd5c8498ee95f9352df87a91139.tar.gz rneovim-1c032ad703a19cd5c8498ee95f9352df87a91139.tar.bz2 rneovim-1c032ad703a19cd5c8498ee95f9352df87a91139.zip |
feat(extmark): window scoped extmark
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/nvim/marktree.h')
-rw-r--r-- | src/nvim/marktree.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/nvim/marktree.h b/src/nvim/marktree.h index 1fb1a74487..8e5cf30ff3 100644 --- a/src/nvim/marktree.h +++ b/src/nvim/marktree.h @@ -4,6 +4,7 @@ #include <stddef.h> // IWYU pragma: keep #include <stdint.h> +#include "nvim/buffer_defs.h" #include "nvim/decoration_defs.h" #include "nvim/marktree_defs.h" // IWYU pragma: keep #include "nvim/pos_defs.h" // IWYU pragma: keep @@ -34,6 +35,8 @@ #define MT_FLAG_DECOR_VIRT_LINES (((uint16_t)1) << 11) #define MT_FLAG_DECOR_VIRT_TEXT_INLINE (((uint16_t)1) << 12) +#define MT_FLAG_SCOPED (((uint16_t)1) << 13) + // These _must_ be last to preserve ordering of marks #define MT_FLAG_RIGHT_GRAVITY (((uint16_t)1) << 14) #define MT_FLAG_LAST (((uint16_t)1) << 15) @@ -43,7 +46,7 @@ | MT_FLAG_DECOR_VIRT_TEXT_INLINE) #define MT_FLAG_EXTERNAL_MASK (MT_FLAG_DECOR_MASK | MT_FLAG_NO_UNDO \ - | MT_FLAG_INVALIDATE | MT_FLAG_INVALID) + | MT_FLAG_INVALIDATE | MT_FLAG_INVALID | MT_FLAG_SCOPED) // this is defined so that start and end of the same range have adjacent ids #define MARKTREE_END_FLAG ((uint64_t)1) @@ -107,12 +110,24 @@ static inline bool mt_decor_sign(MTKey key) return key.flags & (MT_FLAG_DECOR_SIGNTEXT | MT_FLAG_DECOR_SIGNHL); } -static inline uint16_t mt_flags(bool right_gravity, bool no_undo, bool invalidate, bool decor_ext) +static inline bool mt_scoped(MTKey key) +{ + return key.flags & MT_FLAG_SCOPED; +} + +static inline bool mt_scoped_in_win(MTKey key, win_T *wp) +{ + return !mt_scoped(key) || set_has(uint32_t, &wp->w_ns_set, key.ns); +} + +static inline uint16_t mt_flags(bool right_gravity, bool no_undo, bool invalidate, bool decor_ext, + bool scoped) { return (uint16_t)((right_gravity ? MT_FLAG_RIGHT_GRAVITY : 0) | (no_undo ? MT_FLAG_NO_UNDO : 0) | (invalidate ? MT_FLAG_INVALIDATE : 0) - | (decor_ext ? MT_FLAG_DECOR_EXT : 0)); + | (decor_ext ? MT_FLAG_DECOR_EXT : 0) + | (scoped ? MT_FLAG_SCOPED : 0)); } static inline MTPair mtpair_from(MTKey start, MTKey end) |