feat(decorations): support signs

Add the following options to extmarks:
  - sign_text
  - sign_hl_group
  - number_hl_group
  - line_hl_group
  - cursorline_hl_group

Note: ranges are unsupported and decorations are only applied to
start_row
This commit is contained in:
Lewis Russell
2022-01-03 12:22:13 +00:00
parent 83fc914337
commit 30e4cc3b3f
13 changed files with 589 additions and 17 deletions

View File

@@ -47,13 +47,18 @@ struct Decoration {
bool virt_text_hide;
bool hl_eol;
bool virt_lines_above;
// TODO(bfredl): style, signs, etc
// TODO(bfredl): style, etc
DecorPriority priority;
int col; // fixed col value, like win_col
int virt_text_width; // width of virt_text
char_u *sign_text;
int sign_hl_id;
int number_hl_id;
int line_hl_id;
int cursorline_hl_id;
};
#define DECORATION_INIT { KV_INITIAL_VALUE, KV_INITIAL_VALUE, 0, kVTEndOfLine, kHlModeUnknown, \
false, false, false, DECOR_PRIORITY_BASE, 0, 0 }
false, false, false, DECOR_PRIORITY_BASE, 0, 0, NULL, 0, 0, 0, 0 }
typedef struct {
int start_row;
@@ -75,6 +80,7 @@ typedef struct {
int col_until;
int current;
int eol_col;
bool has_sign_decor;
} DecorState;
typedef struct {
@@ -98,6 +104,15 @@ EXTERN bool provider_active INIT(= false);
LUA_NOREF, LUA_NOREF, LUA_NOREF, \
LUA_NOREF, -1 }
static inline bool decor_has_sign(Decoration *decor)
{
return decor->sign_text
|| decor->sign_hl_id
|| decor->number_hl_id
|| decor->line_hl_id
|| decor->cursorline_hl_id;
}
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "decoration.h.generated.h"
#endif