diff options
Diffstat (limited to 'src/display_buffer.hh')
| -rw-r--r-- | src/display_buffer.hh | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/display_buffer.hh b/src/display_buffer.hh index 37958880..320019d6 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -29,16 +29,17 @@ enum Attributes Bold = 8 }; -struct AtomContent +struct DisplayAtom { public: enum Type { BufferRange, ReplacedBufferRange, Text }; - AtomContent(const Buffer& buffer, BufferCoord begin, BufferCoord end) + DisplayAtom(const Buffer& buffer, BufferCoord begin, BufferCoord end) : m_type(BufferRange), m_buffer(&buffer), m_begin(begin), m_end(end) {} - AtomContent(String str) - : m_type(Text), m_text(std::move(str)) {} + DisplayAtom(String str, ColorPair colors = { Colors::Default, Colors::Default }, + Attribute attribute = Normal) + : m_type(Text), m_text(std::move(str)), colors(colors), attribute(attribute) {} String content() const { @@ -97,6 +98,11 @@ public: void trim_begin(CharCount count); void trim_end(CharCount count); + +public: + ColorPair colors = {Colors::Default, Colors::Default}; + Attribute attribute = Normal; + private: friend class DisplayLine; @@ -108,19 +114,6 @@ private: String m_text; }; -struct DisplayAtom -{ - ColorPair colors; - Attribute attribute; - AtomContent content; - - DisplayAtom(AtomContent content, - ColorPair colors = {Colors::Default, Colors::Default}, - Attribute attribute = Normal) - : content{std::move(content)}, colors{colors}, attribute{attribute} - {} -}; - using BufferRange = std::pair<BufferCoord, BufferCoord>; using AtomList = std::vector<DisplayAtom>; |
