fix Buffer::clear() to update iterators

This commit is contained in:
Josh Holtrop 2017-01-18 22:51:33 -05:00
parent 47d15ca858
commit 276c756bb7
2 changed files with 11 additions and 1 deletions

View File

@ -461,3 +461,13 @@ void Buffer::redo()
m_current_change_operation_index = child_index; m_current_change_operation_index = child_index;
} }
} }
void Buffer::clear()
{
m_gap_buffer->clear();
for (auto iterator : m_iterators)
{
auto b = begin();
*iterator = b;
}
}

View File

@ -119,7 +119,7 @@ public:
m_cursors.push_back(iterator); m_cursors.push_back(iterator);
return iterator; return iterator;
} }
void clear() { m_gap_buffer->clear(); } void clear();
auto get_string() { return m_gap_buffer->get_string(); } auto get_string() { return m_gap_buffer->get_string(); }
void set_string(const std::string & s) { m_gap_buffer->set_string(s); } void set_string(const std::string & s) { m_gap_buffer->set_string(s); }
size_t size() const { return m_gap_buffer->size(); } size_t size() const { return m_gap_buffer->size(); }