Filters: fix colorize_regex_range when range is not visible

This commit is contained in:
Maxime Coste 2011-11-26 18:34:49 +00:00
parent 68f3d24199
commit 9c117a821c

View File

@ -15,6 +15,12 @@ void colorize_regex_range(DisplayBuffer& display_buffer,
const boost::regex& ex, const boost::regex& ex,
Color fg_color, Color bg_color = Color::Default) Color fg_color, Color bg_color = Color::Default)
{ {
assert(range_begin <= range_end);
if (range_begin >= display_buffer.back().end() or
range_end <= display_buffer.front().begin())
return;
BufferIterator display_begin = std::max(range_begin, BufferIterator display_begin = std::max(range_begin,
display_buffer.front().begin()); display_buffer.front().begin());
BufferIterator display_end = std::min(range_end, BufferIterator display_end = std::min(range_end,