When inserting at the end, store the next line as end pos in the change

This commit is contained in:
Maxime Coste 2017-01-01 15:33:46 +00:00
parent e42881fa38
commit 69789d4793

View File

@ -484,7 +484,8 @@ BufferCoord Buffer::do_insert(BufferCoord pos, StringView content)
std::make_move_iterator(new_lines.end()));
const LineCount last_line = pos.line + new_lines.size() - 1;
const BufferCoord end = BufferCoord{ last_line, m_lines[last_line].length() - suffix.length() };
const auto end = at_end ? line_count()
: BufferCoord{ last_line, m_lines[last_line].length() - suffix.length() };
m_changes.push_back({ Change::Insert, at_end, pos, end });
return pos;