summaryrefslogtreecommitdiff
path: root/src/display_buffer.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-07-11 00:27:04 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-07-11 00:27:43 +0100
commita32b49acd12538c27bf4f9abb8acd133e8cf2ee8 (patch)
treed1990535a90aa77fe6754f777e5f1c1c261e0ca8 /src/display_buffer.hh
parent42611aef1e84b7dc13735021b8d0b68fedb86d60 (diff)
Rename ColorPair to Face and ColorRegistry to FaceRegistry
Face also stores the attributes
Diffstat (limited to 'src/display_buffer.hh')
-rw-r--r--src/display_buffer.hh28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh
index c0d34dda..e8451753 100644
--- a/src/display_buffer.hh
+++ b/src/display_buffer.hh
@@ -2,7 +2,7 @@
#define display_buffer_hh_INCLUDED
#include "buffer.hh"
-#include "color.hh"
+#include "face.hh"
#include "coord.hh"
#include "string.hh"
#include "utf8.hh"
@@ -12,17 +12,6 @@
namespace Kakoune
{
-using Attribute = char;
-
-enum Attributes
-{
- Normal = 0,
- Underline = 1,
- Reverse = 2,
- Blink = 4,
- Bold = 8
-};
-
struct DisplayAtom
{
public:
@@ -32,9 +21,8 @@ public:
: m_type(BufferRange), m_buffer(&buffer), m_begin(begin), m_end(end)
{ check_invariant(); }
- DisplayAtom(String str, ColorPair colors = { Colors::Default, Colors::Default },
- Attribute attribute = Normal)
- : m_type(Text), m_text(std::move(str)), colors(colors), attribute(attribute)
+ DisplayAtom(String str, Face face = Face{})
+ : m_type(Text), m_text(std::move(str)), face(face)
{ check_invariant(); }
StringView content() const
@@ -108,13 +96,11 @@ public:
bool operator==(const DisplayAtom& other) const
{
- return colors == other.colors or attribute == other.attribute or
- content() == other.content();
+ return face == other.face and content() == other.content();
}
public:
- ColorPair colors = {Colors::Default, Colors::Default};
- Attribute attribute = Normal;
+ Face face;
private:
friend class DisplayLine;
@@ -139,8 +125,8 @@ public:
DisplayLine() = default;
DisplayLine(AtomList atoms);
- DisplayLine(String str, ColorPair color)
- { push_back({ std::move(str), color }); }
+ DisplayLine(String str, Face face)
+ { push_back({ std::move(str), face }); }
iterator begin() { return m_atoms.begin(); }
iterator end() { return m_atoms.end(); }