summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-10-23 13:34:03 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-10-23 13:46:41 +0100
commite7152bad56906838fb306aee15b04ab778f2c69c (patch)
treea4f9dfd5bdb70cdedfa0560e87dcbfe741ce8de3 /src
parent1ba37bacd8cda9c24d074887e2c10a8881f9c861 (diff)
Add an exclusive attribute that overrides existing face
Diffstat (limited to 'src')
-rw-r--r--src/face.hh20
-rw-r--r--src/face_registry.cc1
2 files changed, 12 insertions, 9 deletions
diff --git a/src/face.hh b/src/face.hh
index 2540705e..806089a9 100644
--- a/src/face.hh
+++ b/src/face.hh
@@ -10,12 +10,13 @@ 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,
+ Exclusive = 1 << 1,
+ Underline = 1 << 2,
+ Reverse = 1 << 3,
+ Blink = 1 << 4,
+ Bold = 1 << 5,
+ Dim = 1 << 6,
+ Italic = 1 << 7,
};
template<> struct WithBitOps<Attribute> : std::true_type {};
@@ -45,9 +46,10 @@ constexpr bool operator!=(const Face& lhs, const Face& rhs)
constexpr Face merge_faces(const Face& base, const Face& face)
{
- return { face.fg == Color::Default ? base.fg : face.fg,
- face.bg == Color::Default ? base.bg : face.bg,
- face.attributes | base.attributes };
+ return face.attributes & Attribute::Exclusive ?
+ face : Face{ face.fg == Color::Default ? base.fg : face.fg,
+ face.bg == Color::Default ? base.bg : face.bg,
+ face.attributes | base.attributes };
}
}
diff --git a/src/face_registry.cc b/src/face_registry.cc
index a1a0e582..2f0be21b 100644
--- a/src/face_registry.cc
+++ b/src/face_registry.cc
@@ -24,6 +24,7 @@ static Face parse_face(StringView facedesc)
{
switch (*attr_it)
{
+ case 'e': res.attributes |= Attribute::Exclusive; break;
case 'u': res.attributes |= Attribute::Underline; break;
case 'r': res.attributes |= Attribute::Reverse; break;
case 'b': res.attributes |= Attribute::Bold; break;