More cleanups in Buffer::do_insert
This commit is contained in:
parent
338462e94f
commit
c5b24e2a8a
|
@ -342,8 +342,6 @@ ByteCoord Buffer::do_insert(ByteCoord pos, StringView content)
|
||||||
if (content.empty())
|
if (content.empty())
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
ByteCoord begin;
|
|
||||||
ByteCoord end;
|
|
||||||
const bool at_end = is_end(pos);
|
const bool at_end = is_end(pos);
|
||||||
if (at_end)
|
if (at_end)
|
||||||
pos = line_count();
|
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_it),
|
||||||
std::make_move_iterator(new_lines.end()));
|
std::make_move_iterator(new_lines.end()));
|
||||||
|
|
||||||
begin = pos;
|
|
||||||
const LineCount last_line = pos.line + new_lines.size() - 1;
|
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 });
|
m_changes.push_back({ Change::Insert, at_end, pos, end });
|
||||||
return begin;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteCoord Buffer::do_erase(ByteCoord begin, ByteCoord end)
|
ByteCoord Buffer::do_erase(ByteCoord begin, ByteCoord end)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user