refactor(highlight): reshape the HL_UNDER* bits into a 3-bit integer mask

Saves two bits for reuse for new features
This commit is contained in:
Paul "LeoNerd" Evans
2023-01-19 17:51:56 +00:00
parent c6ab8dfc15
commit f5d357de55
4 changed files with 68 additions and 66 deletions

View File

@@ -15,19 +15,22 @@ typedef enum {
HL_INVERSE = 0x01,
HL_BOLD = 0x02,
HL_ITALIC = 0x04,
// The next three bits are all underline styles
HL_UNDERLINE_MASK = 0x38,
HL_UNDERLINE = 0x08,
HL_UNDERCURL = 0x10,
HL_UNDERDOUBLE = 0x20,
HL_UNDERDOTTED = 0x40,
HL_UNDERDASHED = 0x80,
HL_STANDOUT = 0x0100,
HL_NOCOMBINE = 0x0200,
HL_STRIKETHROUGH = 0x0400,
HL_UNDERDOUBLE = 0x10,
HL_UNDERCURL = 0x18,
HL_UNDERDOTTED = 0x20,
HL_UNDERDASHED = 0x28,
// 0x30 and 0x38 spare for underline styles
HL_STANDOUT = 0x0040,
HL_STRIKETHROUGH = 0x0080,
// 0x0100-0x0200 spare
HL_NOCOMBINE = 0x0400,
HL_BG_INDEXED = 0x0800,
HL_FG_INDEXED = 0x1000,
HL_DEFAULT = 0x2000,
HL_GLOBAL = 0x4000,
HL_ANY_UNDERLINE = HL_UNDERLINE | HL_UNDERDOUBLE | HL_UNDERCURL | HL_UNDERDOTTED | HL_UNDERDASHED,
} HlAttrFlags;
/// Stores a complete highlighting entry, including colors and attributes