diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-03-16 13:22:11 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-03-16 13:22:11 +0000 |
| commit | c5b24e2a8a783fda939c6576158e0d9d591d632b (patch) | |
| tree | fcda9117becdecbb63dbe586aa38ef689b4bd99c /src/buffer.cc | |
| parent | 338462e94f6c0d5b713e5bec8239b7cdc6bac9f8 (diff) | |
More cleanups in Buffer::do_insert
Diffstat (limited to 'src/buffer.cc')
| -rw-r--r-- | src/buffer.cc | 9 |
1 files 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) |
