2011-09-02 18:51:20 +02:00
|
|
|
#ifndef display_buffer_hh_INCLUDED
|
|
|
|
#define display_buffer_hh_INCLUDED
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2011-09-28 22:54:11 +02:00
|
|
|
#include "buffer.hh"
|
|
|
|
|
2011-09-02 18:51:20 +02:00
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef int Attribute;
|
|
|
|
|
|
|
|
enum Attributes
|
|
|
|
{
|
2011-09-26 01:51:12 +02:00
|
|
|
Normal = 0,
|
|
|
|
Underline = 1,
|
|
|
|
Reverse = 2,
|
|
|
|
Blink = 4,
|
|
|
|
Bold = 8,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class Color
|
|
|
|
{
|
|
|
|
Default,
|
|
|
|
Black,
|
|
|
|
Red,
|
|
|
|
Green,
|
|
|
|
Yellow,
|
|
|
|
Blue,
|
|
|
|
Magenta,
|
|
|
|
Cyan,
|
|
|
|
White
|
2011-09-02 18:51:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct DisplayAtom
|
|
|
|
{
|
2011-09-28 22:54:11 +02:00
|
|
|
std::string content;
|
|
|
|
BufferIterator begin;
|
|
|
|
BufferIterator end;
|
|
|
|
Color fg_color;
|
|
|
|
Color bg_color;
|
|
|
|
Attribute attribute;
|
2011-09-02 18:51:20 +02:00
|
|
|
|
2011-09-28 22:54:11 +02:00
|
|
|
DisplayAtom(BufferIterator begin, BufferIterator end,
|
|
|
|
const std::string& content)
|
|
|
|
: content(content),
|
|
|
|
begin(begin),
|
|
|
|
end(end),
|
|
|
|
fg_color(Color::Default),
|
2011-09-26 01:51:12 +02:00
|
|
|
bg_color(Color::Default),
|
|
|
|
attribute(Attributes::Normal)
|
|
|
|
{}
|
2011-09-02 18:51:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class DisplayBuffer
|
|
|
|
{
|
|
|
|
public:
|
2011-09-28 22:54:11 +02:00
|
|
|
typedef std::vector<DisplayAtom> AtomList;
|
2011-09-02 18:51:20 +02:00
|
|
|
typedef AtomList::iterator iterator;
|
|
|
|
typedef AtomList::const_iterator const_iterator;
|
|
|
|
|
|
|
|
DisplayBuffer();
|
|
|
|
|
|
|
|
void clear() { m_atoms.clear(); }
|
|
|
|
void append(const DisplayAtom& atom) { m_atoms.push_back(atom); }
|
2011-09-28 22:54:11 +02:00
|
|
|
iterator insert(iterator where, const DisplayAtom& atom) { return m_atoms.insert(where, atom); }
|
2011-09-02 18:51:20 +02:00
|
|
|
|
|
|
|
iterator begin() { return m_atoms.begin(); }
|
|
|
|
iterator end() { return m_atoms.end(); }
|
|
|
|
|
|
|
|
const_iterator begin() const { return m_atoms.begin(); }
|
|
|
|
const_iterator end() const { return m_atoms.end(); }
|
|
|
|
private:
|
|
|
|
AtomList m_atoms;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // display_buffer_hh_INCLUDED
|