Remove special case when appending at eol

This commit is contained in:
Maxime Coste 2014-12-13 13:10:40 +00:00
parent a834f1aa75
commit fc4d77964e

View File

@ -443,11 +443,7 @@ BufferIterator prepare_insert(Buffer& buffer, const Selection& sel, InsertMode m
case InsertMode::Replace: case InsertMode::Replace:
return erase(buffer, sel); return erase(buffer, sel);
case InsertMode::Append: case InsertMode::Append:
{ return utf8::next(buffer.iterator_at(sel.max()), buffer.end());
// special case for end of lines, append to current line instead
auto pos = buffer.iterator_at(sel.max());
return *pos == '\n' ? pos : utf8::next(pos, buffer.end());
}
case InsertMode::InsertAtLineBegin: case InsertMode::InsertAtLineBegin:
return buffer.iterator_at(sel.min().line); return buffer.iterator_at(sel.min().line);
case InsertMode::AppendAtLineEnd: case InsertMode::AppendAtLineEnd: