DisplayBuffer: overload atom_containing with a version taking an iterator to search start
This commit is contained in:
parent
ad6ee464f4
commit
fffa405bfd
|
@ -88,10 +88,16 @@ DisplayBuffer::iterator DisplayBuffer::insert(iterator where, const DisplayAtom&
|
||||||
|
|
||||||
DisplayBuffer::iterator DisplayBuffer::atom_containing(const BufferIterator& where)
|
DisplayBuffer::iterator DisplayBuffer::atom_containing(const BufferIterator& where)
|
||||||
{
|
{
|
||||||
for (iterator it = m_atoms.begin(); it != m_atoms.end(); ++it)
|
return atom_containing(where, m_atoms.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayBuffer::iterator DisplayBuffer::atom_containing(const BufferIterator& where,
|
||||||
|
iterator start)
|
||||||
|
{
|
||||||
|
for (iterator it = start; it != m_atoms.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->end() > where)
|
if (it->end() > where)
|
||||||
return it;
|
return it->begin() <= where ? it : end();
|
||||||
}
|
}
|
||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ public:
|
||||||
const_iterator end() const { return m_atoms.end(); }
|
const_iterator end() const { return m_atoms.end(); }
|
||||||
|
|
||||||
iterator atom_containing(const BufferIterator& where);
|
iterator atom_containing(const BufferIterator& where);
|
||||||
|
iterator atom_containing(const BufferIterator& where, iterator start);
|
||||||
|
|
||||||
const DisplayAtom& front() const { return m_atoms.front(); }
|
const DisplayAtom& front() const { return m_atoms.front(); }
|
||||||
const DisplayAtom& back() const { return m_atoms.back(); }
|
const DisplayAtom& back() const { return m_atoms.back(); }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user