summaryrefslogtreecommitdiff
path: root/src/display_buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2011-11-14 14:10:11 +0000
committerMaxime Coste <frrrwww@gmail.com>2011-11-14 14:10:11 +0000
commitd2b9cd6e60d69d6a1e1bb206a865d481bb739bf8 (patch)
tree571bed2b645c6a4ce464c65dfde4f79245a6b9be /src/display_buffer.cc
parent0dc8442ca40cc6d914de20be40533382287b0ffd (diff)
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).
Diffstat (limited to 'src/display_buffer.cc')
-rw-r--r--src/display_buffer.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/display_buffer.cc b/src/display_buffer.cc
index 547cca2b..dbae0e4f 100644
--- a/src/display_buffer.cc
+++ b/src/display_buffer.cc
@@ -106,14 +106,18 @@ DisplayBuffer::iterator DisplayBuffer::split(iterator atom, const BufferIterator
{
assert(pos > atom->begin());
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->m_begin = pos;
- atom->m_coord = new_atom.end_coord();
- iterator res = m_atoms.insert(atom, std::move(new_atom));
+ iterator insert_pos = atom;
+ ++insert_pos;
+ m_atoms.insert(insert_pos, std::move(new_atom));
check_invariant();
- return res;
+ return atom;
}
void DisplayBuffer::check_invariant() const