DisplayAtom: only let DisplayLine touch m_begin and m_end

This commit is contained in:
Maxime Coste 2012-10-08 14:28:38 +02:00
parent 7e046e3f0b
commit 5602bc10e8
2 changed files with 8 additions and 4 deletions

View File

@ -12,8 +12,8 @@ DisplayLine::iterator DisplayLine::split(iterator it, BufferIterator pos)
assert(it->content.end() > pos); assert(it->content.end() > pos);
DisplayAtom atom = *it; DisplayAtom atom = *it;
atom.content.end() = pos; atom.content.m_end = pos;
it->content.begin() = pos; it->content.m_begin = pos;
return m_atoms.insert(it, std::move(atom)); return m_atoms.insert(it, std::move(atom));
} }

View File

@ -32,6 +32,8 @@ enum Attributes
Bold = 8 Bold = 8
}; };
class DisplayLine;
struct AtomContent struct AtomContent
{ {
public: public:
@ -69,13 +71,13 @@ public:
} }
} }
BufferIterator& begin() const BufferIterator& begin() const
{ {
assert(has_buffer_range()); assert(has_buffer_range());
return m_begin; return m_begin;
} }
BufferIterator& end() const BufferIterator& end() const
{ {
assert(has_buffer_range()); assert(has_buffer_range());
return m_end; return m_end;
@ -96,6 +98,8 @@ public:
Type type() const { return m_type; } Type type() const { return m_type; }
private: private:
friend class DisplayLine;
Type m_type; Type m_type;
BufferIterator m_begin; BufferIterator m_begin;