From 36e4dacdf5e33b9d92ea59124ef67a040b5392cb Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 28 Jun 2012 14:26:01 +0200 Subject: Fix BufferIterator::on_erase and tweak Buffer --- src/buffer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/buffer.cc') diff --git a/src/buffer.cc b/src/buffer.cc index 30cf6d38..4c29837a 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -152,7 +152,7 @@ void Buffer::end_undo_group() if (m_current_undo_group.empty()) return; - m_history.push_back(m_current_undo_group); + m_history.push_back(std::move(m_current_undo_group)); m_history_cursor = m_history.end(); m_current_undo_group.clear(); @@ -277,6 +277,7 @@ void Buffer::insert(const BufferIterator& pos, const String& content) void Buffer::erase(const BufferIterator& pos, BufferSize length) { BufferIterator end = pos + length; + assert(end.is_valid()); String prefix = m_lines[pos.line()].content.substr(0, pos.column()); String suffix = m_lines[end.line()].content.substr(end.column()); Line new_line = { m_lines[pos.line()].start, prefix + suffix }; -- cgit v1.2.3