2011-09-02 18:51:20 +02:00
|
|
|
#include "display_buffer.hh"
|
|
|
|
|
2011-09-29 10:55:08 +02:00
|
|
|
#include "assert.h"
|
|
|
|
|
2011-09-02 18:51:20 +02:00
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
DisplayBuffer::DisplayBuffer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:55:08 +02:00
|
|
|
DisplayBuffer::iterator DisplayBuffer::split(iterator atom, size_t pos_in_atom)
|
|
|
|
{
|
|
|
|
assert(atom < end());
|
|
|
|
assert(pos_in_atom < atom->content.length());
|
|
|
|
DisplayAtom new_atom(atom->begin, atom->begin + pos_in_atom,
|
|
|
|
atom->content.substr(0, pos_in_atom),
|
|
|
|
atom->fg_color, atom->bg_color, atom->attribute);
|
|
|
|
|
|
|
|
atom->begin = atom->begin + pos_in_atom;
|
|
|
|
atom->content = atom->content.substr(pos_in_atom);
|
|
|
|
return insert(atom, std::move(new_atom));
|
|
|
|
}
|
|
|
|
|
2011-09-02 18:51:20 +02:00
|
|
|
}
|