mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 06:16:08 +00:00
decoration: split out "decoration" from "extmark" module
Decorations will only grow more complex. move the to a separate file, so that extmark.c remains about extmarks.
This commit is contained in:
71
src/nvim/decoration.h
Normal file
71
src/nvim/decoration.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef NVIM_DECORATION_H
|
||||
#define NVIM_DECORATION_H
|
||||
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/extmark_defs.h"
|
||||
|
||||
// actual Decoration data is in extmark_defs.h
|
||||
|
||||
typedef struct {
|
||||
char *text;
|
||||
int hl_id;
|
||||
} VirtTextChunk;
|
||||
|
||||
typedef kvec_t(VirtTextChunk) VirtText;
|
||||
#define VIRTTEXT_EMPTY ((VirtText)KV_INITIAL_VALUE)
|
||||
|
||||
struct Decoration
|
||||
{
|
||||
int hl_id; // highlight group
|
||||
VirtText virt_text;
|
||||
// TODO(bfredl): style, signs, etc
|
||||
bool shared; // shared decoration, don't free
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int start_row;
|
||||
int start_col;
|
||||
int end_row;
|
||||
int end_col;
|
||||
int attr_id;
|
||||
VirtText *virt_text;
|
||||
bool virt_text_owned;
|
||||
} HlRange;
|
||||
|
||||
typedef struct {
|
||||
MarkTreeIter itr[1];
|
||||
kvec_t(HlRange) active;
|
||||
buf_T *buf;
|
||||
int top_row;
|
||||
int row;
|
||||
int col_until;
|
||||
int current;
|
||||
VirtText *virt_text;
|
||||
} DecorState;
|
||||
|
||||
typedef struct {
|
||||
NS ns_id;
|
||||
bool active;
|
||||
LuaRef redraw_start;
|
||||
LuaRef redraw_buf;
|
||||
LuaRef redraw_win;
|
||||
LuaRef redraw_line;
|
||||
LuaRef redraw_end;
|
||||
LuaRef hl_def;
|
||||
int hl_valid;
|
||||
} DecorProvider;
|
||||
|
||||
EXTERN kvec_t(DecorProvider) decor_providers INIT(= KV_INITIAL_VALUE);
|
||||
EXTERN DecorState decor_state INIT(= { 0 });
|
||||
|
||||
#define DECORATION_PROVIDER_INIT(ns_id) (DecorProvider) \
|
||||
{ ns_id, false, LUA_NOREF, LUA_NOREF, \
|
||||
LUA_NOREF, LUA_NOREF, LUA_NOREF, \
|
||||
LUA_NOREF, -1 }
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "decoration.h.generated.h"
|
||||
#endif
|
||||
|
||||
#endif // NVIM_DECORATION_H
|
Reference in New Issue
Block a user