Fix buffer reloading
This commit is contained in:
parent
09fc14be4b
commit
c004187f32
|
@ -171,12 +171,13 @@ void Buffer::reload(BufferLines lines, time_t fs_timestamp)
|
||||||
if (lines.empty())
|
if (lines.empty())
|
||||||
lines.emplace_back(StringStorage::create("\n"));
|
lines.emplace_back(StringStorage::create("\n"));
|
||||||
|
|
||||||
for (auto& line : lines)
|
for (size_t l = 0; l < lines.size(); ++l)
|
||||||
{
|
{
|
||||||
|
auto& line = lines[l];
|
||||||
kak_assert(not line->length == 0 and line->data()[line->length-1] == '\n');
|
kak_assert(not line->length == 0 and line->data()[line->length-1] == '\n');
|
||||||
if (not (m_flags & Flags::NoUndo))
|
if (not (m_flags & Flags::NoUndo))
|
||||||
m_current_undo_group.emplace_back(
|
m_current_undo_group.emplace_back(
|
||||||
Modification::Insert, line_count()-1, m_lines.back());
|
Modification::Insert, LineCount{(int)l}, SharedString{line});
|
||||||
}
|
}
|
||||||
static_cast<BufferLines&>(m_lines) = std::move(lines);
|
static_cast<BufferLines&>(m_lines) = std::move(lines);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user