Merge remote-tracking branch 'lenormf/fix-3226'

This commit is contained in:
Maxime Coste 2019-11-26 21:33:49 +11:00
commit 2f8100b362
2 changed files with 2 additions and 2 deletions

View File

@ -282,7 +282,7 @@ void Buffer::reload(StringView data, timespec fs_timestamp)
parsed_lines.lines[(int)(d.posB + line)]}); parsed_lines.lines[(int)(d.posB + line)]});
m_changes.push_back({ Change::Insert, cur_line, cur_line + d.len }); m_changes.push_back({ Change::Insert, cur_line, cur_line + d.len });
m_lines.insert(it, &parsed_lines.lines[d.posB], &parsed_lines.lines[d.posB + d.len]); m_lines.insert(it, parsed_lines.lines.begin() + d.posB, parsed_lines.lines.begin() + d.posB + d.len);
it = m_lines.begin() + (int)(cur_line + d.len); it = m_lines.begin() + (int)(cur_line + d.len);
} }
else if (d.mode == Diff::Remove) else if (d.mode == Diff::Remove)

View File

@ -512,7 +512,7 @@ BufferCoord apply_diff(Buffer& buffer, BufferCoord pos, StringView before, Strin
lines_after.begin(), (int)lines_after.size()); lines_after.begin(), (int)lines_after.size());
auto byte_count = [](auto&& lines, int first, int count) { auto byte_count = [](auto&& lines, int first, int count) {
return std::accumulate(&lines[first], &lines[first+count], 0_byte, return std::accumulate(lines.begin() + first, lines.begin() + first + count, 0_byte,
[](ByteCount l, StringView s) { return l + s.length(); }); [](ByteCount l, StringView s) { return l + s.length(); });
}; };