fix DisplayBuffer::atom_containing when where is before first atom

This commit is contained in:
Maxime Coste 2012-05-04 06:39:03 +00:00
parent ebe945f344
commit dd7228b098

View File

@ -93,6 +93,9 @@ DisplayBuffer::iterator DisplayBuffer::atom_containing(const BufferIterator& whe
DisplayBuffer::iterator DisplayBuffer::atom_containing(const BufferIterator& where,
iterator start)
{
if (where < start->begin())
return end();
return std::upper_bound(start, end(), where,
[](const BufferIterator& where, const DisplayAtom& atom)
{ return where < atom.end(); });