DisplayBuffer: split now preserve iterator parameter
that means that the given iterator points to the first part of the split (instead of the second in previous implementation).
This commit is contained in:
parent
0dc8442ca4
commit
d2b9cd6e60
|
@ -106,14 +106,18 @@ DisplayBuffer::iterator DisplayBuffer::split(iterator atom, const BufferIterator
|
||||||
{
|
{
|
||||||
assert(pos > atom->begin());
|
assert(pos > atom->begin());
|
||||||
assert(pos < atom->end());
|
assert(pos < atom->end());
|
||||||
DisplayAtom new_atom(atom->coord(), atom->begin(), pos,
|
|
||||||
|
BufferIterator end = atom->m_end;
|
||||||
|
atom->m_end = pos;
|
||||||
|
|
||||||
|
DisplayAtom new_atom(atom->end_coord(), pos, end,
|
||||||
atom->fg_color(), atom->bg_color(), atom->attribute());
|
atom->fg_color(), atom->bg_color(), atom->attribute());
|
||||||
|
|
||||||
atom->m_begin = pos;
|
iterator insert_pos = atom;
|
||||||
atom->m_coord = new_atom.end_coord();
|
++insert_pos;
|
||||||
iterator res = m_atoms.insert(atom, std::move(new_atom));
|
m_atoms.insert(insert_pos, std::move(new_atom));
|
||||||
check_invariant();
|
check_invariant();
|
||||||
return res;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayBuffer::check_invariant() const
|
void DisplayBuffer::check_invariant() const
|
||||||
|
|
Loading…
Reference in New Issue
Block a user