Add an exclusive attribute that overrides existing face
This commit is contained in:
parent
1ba37bacd8
commit
e7152bad56
16
src/face.hh
16
src/face.hh
|
@ -10,12 +10,13 @@ namespace Kakoune
|
||||||
enum class Attribute : int
|
enum class Attribute : int
|
||||||
{
|
{
|
||||||
Normal = 0,
|
Normal = 0,
|
||||||
Underline = 1 << 1,
|
Exclusive = 1 << 1,
|
||||||
Reverse = 1 << 2,
|
Underline = 1 << 2,
|
||||||
Blink = 1 << 3,
|
Reverse = 1 << 3,
|
||||||
Bold = 1 << 4,
|
Blink = 1 << 4,
|
||||||
Dim = 1 << 5,
|
Bold = 1 << 5,
|
||||||
Italic = 1 << 6,
|
Dim = 1 << 6,
|
||||||
|
Italic = 1 << 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct WithBitOps<Attribute> : std::true_type {};
|
template<> struct WithBitOps<Attribute> : std::true_type {};
|
||||||
|
@ -45,7 +46,8 @@ constexpr bool operator!=(const Face& lhs, const Face& rhs)
|
||||||
|
|
||||||
constexpr Face merge_faces(const Face& base, const Face& face)
|
constexpr Face merge_faces(const Face& base, const Face& face)
|
||||||
{
|
{
|
||||||
return { face.fg == Color::Default ? base.fg : face.fg,
|
return face.attributes & Attribute::Exclusive ?
|
||||||
|
face : Face{ face.fg == Color::Default ? base.fg : face.fg,
|
||||||
face.bg == Color::Default ? base.bg : face.bg,
|
face.bg == Color::Default ? base.bg : face.bg,
|
||||||
face.attributes | base.attributes };
|
face.attributes | base.attributes };
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ static Face parse_face(StringView facedesc)
|
||||||
{
|
{
|
||||||
switch (*attr_it)
|
switch (*attr_it)
|
||||||
{
|
{
|
||||||
|
case 'e': res.attributes |= Attribute::Exclusive; break;
|
||||||
case 'u': res.attributes |= Attribute::Underline; break;
|
case 'u': res.attributes |= Attribute::Underline; break;
|
||||||
case 'r': res.attributes |= Attribute::Reverse; break;
|
case 'r': res.attributes |= Attribute::Reverse; break;
|
||||||
case 'b': res.attributes |= Attribute::Bold; break;
|
case 'b': res.attributes |= Attribute::Bold; break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user