summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-06-28 14:26:01 +0200
committerMaxime Coste <frrrwww@gmail.com>2012-06-28 14:26:01 +0200
commit36e4dacdf5e33b9d92ea59124ef67a040b5392cb (patch)
tree39935e0e6e8315c14d3f53b3a38e5f5b813a8a9f /src/buffer.cc
parent9b6b6b6b174578740b26c0d1da43b6615889d1b9 (diff)
Fix BufferIterator::on_erase and tweak Buffer
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc3
1 files changed, 2 insertions, 1 deletions
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 };