From c5b24e2a8a783fda939c6576158e0d9d591d632b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 16 Mar 2016 13:22:11 +0000 Subject: [PATCH] More cleanups in Buffer::do_insert --- src/buffer.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/buffer.cc b/src/buffer.cc index aff0f80d..a28b81cb 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -342,8 +342,6 @@ ByteCoord Buffer::do_insert(ByteCoord pos, StringView content) if (content.empty()) return pos; - ByteCoord begin; - ByteCoord end; const bool at_end = is_end(pos); if (at_end) pos = line_count(); @@ -378,12 +376,11 @@ ByteCoord Buffer::do_insert(ByteCoord pos, StringView content) std::make_move_iterator(new_lines_it), std::make_move_iterator(new_lines.end())); - begin = pos; const LineCount last_line = pos.line + new_lines.size() - 1; - end = ByteCoord{ last_line, m_lines[last_line].length() - suffix.length() }; + const ByteCoord end = ByteCoord{ last_line, m_lines[last_line].length() - suffix.length() }; - m_changes.push_back({ Change::Insert, at_end, begin, end }); - return begin; + m_changes.push_back({ Change::Insert, at_end, pos, end }); + return pos; } ByteCoord Buffer::do_erase(ByteCoord begin, ByteCoord end)