summaryrefslogtreecommitdiff
path: root/src/face.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-09-07 08:21:26 +1000
committerMaxime Coste <mawww@kakoune.org>2021-09-07 08:21:26 +1000
commit3fc8e29d101b4f6eef2538cdbe799bab9859f4b3 (patch)
tree27d931e4bed0fb12c8d018f7302c89f634d81350 /src/face.hh
parenta6644d3034eba2db1db6cd3832488897ffb78921 (diff)
Add support for curly underline and separate underline color
Add support for a third color in face definition that controls the underline and a 'c' attribute for curly underline (that takes precedence over 'u' if both are specified) Allow empty colors to mean default, so that `,,red+u` means the same as `default,default,red+u` Fixes #4138
Diffstat (limited to 'src/face.hh')
-rw-r--r--src/face.hh32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/face.hh b/src/face.hh
index 798cd3f3..ce544116 100644
--- a/src/face.hh
+++ b/src/face.hh
@@ -9,18 +9,19 @@ namespace Kakoune
enum class Attribute : int
{
- Normal = 0,
- Underline = 1 << 1,
- Reverse = 1 << 2,
- Blink = 1 << 3,
- Bold = 1 << 4,
- Dim = 1 << 5,
- Italic = 1 << 6,
- Strikethrough = 1 << 7,
- FinalFg = 1 << 8,
- FinalBg = 1 << 9,
- FinalAttr = 1 << 10,
- Final = FinalFg | FinalBg | FinalAttr
+ Normal = 0,
+ Underline = 1 << 1,
+ CurlyUnderline = 1 << 2,
+ Reverse = 1 << 3,
+ Blink = 1 << 4,
+ Bold = 1 << 5,
+ Dim = 1 << 6,
+ Italic = 1 << 7,
+ Strikethrough = 1 << 8,
+ FinalFg = 1 << 9,
+ FinalBg = 1 << 10,
+ FinalAttr = 1 << 11,
+ Final = FinalFg | FinalBg | FinalAttr
};
constexpr bool with_bit_ops(Meta::Type<Attribute>) { return true; }
@@ -30,11 +31,13 @@ struct Face
Color fg = Color::Default;
Color bg = Color::Default;
Attribute attributes = Attribute::Normal;
+ Color underline = Color::Default;
friend constexpr bool operator==(const Face& lhs, const Face& rhs)
{
return lhs.fg == rhs.fg and
lhs.bg == rhs.bg and
+ lhs.underline == rhs.underline and
lhs.attributes == rhs.attributes;
}
@@ -45,7 +48,7 @@ struct Face
friend constexpr size_t hash_value(const Face& val)
{
- return hash_values(val.fg, val.bg, val.attributes);
+ return hash_values(val.fg, val.bg, val.underline, val.attributes);
}
};
@@ -77,7 +80,8 @@ inline Face merge_faces(const Face& base, const Face& face)
choose(&Face::bg, Attribute::FinalBg),
face.attributes & Attribute::FinalAttr ? face.attributes :
base.attributes & Attribute::FinalAttr ? base.attributes :
- face.attributes | base.attributes };
+ face.attributes | base.attributes,
+ choose(&Face::underline, Attribute{0}) };
}
}