Fix select_whole_lines on empty buffer

This commit is contained in:
Maxime Coste 2014-04-10 20:06:17 +01:00
parent cd6d7fdd3c
commit 30bdc8936b

View File

@ -397,7 +397,10 @@ Selection select_whole_lines(const Buffer& buffer, const Selection& selection)
--to_line_start;
skip_while_reverse(to_line_start, buffer.begin(), [](char cur) { return not is_eol(cur); });
if (is_eol(*to_line_start))
++to_line_start;
{
if (++to_line_start == buffer.end())
--to_line_start;
}
skip_while(to_line_end, buffer.end(), [](char cur) { return not is_eol(cur); });
if (to_line_end == buffer.end())