fix InsertMode::OpenLineBelow behaviour in prepare_insert

This commit is contained in:
Maxime Coste 2012-11-26 19:24:38 +01:00
parent cee0a2d128
commit cad4d3c01e

View File

@ -54,9 +54,9 @@ static BufferIterator prepare_insert(Buffer& buffer, const Selection& sel,
return buffer.iterator_at_line_end(sel.end()-1); return buffer.iterator_at_line_end(sel.end()-1);
case InsertMode::OpenLineBelow: case InsertMode::OpenLineBelow:
{ {
auto pos = buffer.iterator_at_line_end(sel.end() - 1); LineCount line = (sel.end() - 1).line();
buffer.insert(pos, "\n"); buffer.insert(buffer.iterator_at_line_end(line), "\n");
return buffer.iterator_at_line_begin(pos.line() + 1); return buffer.iterator_at_line_begin(line + 1);
} }
case InsertMode::OpenLineAbove: case InsertMode::OpenLineAbove:
{ {