feat(decorations): support more than one virt_lines block

This commit is contained in:
Björn Linse
2021-10-13 21:35:37 +02:00
parent 8ade2f5b04
commit 8d7816cf27
13 changed files with 130 additions and 106 deletions

View File

@@ -24,22 +24,34 @@ typedef enum {
kHlModeBlend,
} HlMode;
typedef kvec_t(VirtTextChunk) VirtText;
#define VIRTTEXT_EMPTY ((VirtText)KV_INITIAL_VALUE)
typedef kvec_t(struct virt_line { VirtText line; bool left_col; }) VirtLines;
struct Decoration
{
VirtText virt_text;
VirtLines virt_lines;
int hl_id; // highlight group
VirtTextPos virt_text_pos;
HlMode hl_mode;
// TODO(bfredl): at some point turn this into FLAGS
bool virt_text_hide;
bool hl_eol;
bool shared; // shared decoration, don't free
bool virt_lines_above;
// TODO(bfredl): style, signs, etc
DecorPriority priority;
int col; // fixed col value, like win_col
int virt_text_width; // width of virt_text
};
#define DECORATION_INIT { KV_INITIAL_VALUE, 0, kVTEndOfLine, kHlModeUnknown, \
false, false, false, DECOR_PRIORITY_BASE, 0, 0 }
#define DECORATION_INIT { KV_INITIAL_VALUE, KV_INITIAL_VALUE, 0, kVTEndOfLine, kHlModeUnknown, \
false, false, false, false, DECOR_PRIORITY_BASE, 0, 0 }
typedef struct {
int start_row;
@@ -60,9 +72,7 @@ typedef struct {
int row;
int col_until;
int current;
int eol_col;
VirtText *virt_text;
} DecorState;
typedef struct {