From c004187f32386431d0b84d6e59edb4cd7aba7e8a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 2 Feb 2015 13:24:40 +0000 Subject: Fix buffer reloading --- src/buffer.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 298f9609..a3b23c70 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -171,12 +171,13 @@ void Buffer::reload(BufferLines lines, time_t fs_timestamp) if (lines.empty()) 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'); if (not (m_flags & Flags::NoUndo)) m_current_undo_group.emplace_back( - Modification::Insert, line_count()-1, m_lines.back()); + Modification::Insert, LineCount{(int)l}, SharedString{line}); } static_cast(m_lines) = std::move(lines); -- cgit v1.2.3