From dd7228b098513a920aefaf356a362f07ce1fc520 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 4 May 2012 06:39:03 +0000 Subject: [PATCH] fix DisplayBuffer::atom_containing when where is before first atom --- src/display_buffer.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 133c843f..2ecded59 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -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(); });