summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-01-01 15:33:46 +0000
committerMaxime Coste <mawww@kakoune.org>2017-01-01 16:32:04 +0000
commit69789d4793f91daab4f489147338ed593f34093d (patch)
tree9a30d9d259bcba778d07989feba0441f0dad5408 /src/buffer.cc
parente42881fa380ee2f299dc00bfbc38356f7919b0d2 (diff)
When inserting at the end, store the next line as end pos in the change
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index 99ec68f1..00506c7f 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -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;