diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-07-24 13:55:57 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-07-24 13:55:57 +0100 |
| commit | d6425f1d5090c3225665fff9dcf36e64ff54fb06 (patch) | |
| tree | 80ee5103218e724dd9aed235892a1b1cadef9076 /src/display_buffer.hh | |
| parent | f6308409a16bb80f8daaf14d4e9ed25f6801d3d3 (diff) | |
merge AtomContent into DisplayAtom
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>; |
