patch 8.2.3628: looking terminal colors is a bit slow

Problem:    Looking terminal colors is a bit slow.
Solution:   Cache the terminal colors. (closes #9130, closes #9058)
This commit is contained in:
Bram Moolenaar
2021-11-20 13:47:45 +00:00
parent cdf5fdb294
commit 87fd0924e2
43 changed files with 1056 additions and 212 deletions

View File

@ -122,7 +122,12 @@ typedef enum {
/**
* Mask that can be used to extract the default foreground/background bit.
*/
VTERM_COLOR_DEFAULT_MASK = 0x06
VTERM_COLOR_DEFAULT_MASK = 0x06,
/**
* If set, indicates that the color is invalid.
*/
VTERM_COLOR_INVALID = 0x08
} VTermColorType;
/**
@ -155,6 +160,12 @@ typedef enum {
#define VTERM_COLOR_IS_DEFAULT_BG(col) \
(!!((col)->type & VTERM_COLOR_DEFAULT_BG))
/**
* Returns true if the VTERM_COLOR_INVALID `type` flag is set, indicating
* that the given VTermColor instance is an invalid color.
*/
#define VTERM_COLOR_IS_INVALID(col) (!!((col)->type & VTERM_COLOR_INVALID))
typedef struct {
/**
* Tag indicating which member is actually valid.