do not store a change operation with no change units

This commit is contained in:
josh committed 2017-01-11 22:53:19 -05:00
1 parent 2057c69585
commit cac339a9f2
1 file changed
+4 -1
+4 -1
View File
@@ -353,6 +353,8 @@ void Buffer::record_change(size_t offset, size_t length, bool insert)
void Buffer::save_current_operation()
{
if (m_current_change_operation)
{
if (m_current_change_operation->changes.size() > 0u)
{
size_t new_change_operation_index = m_change_operations.size();
if (m_current_change_operation_index < new_change_operation_index)
@@ -360,9 +362,10 @@ void Buffer::save_current_operation()
m_change_operations[m_current_change_operation_index]->children.push_back(new_change_operation_index);
}
m_change_operations.push_back(m_current_change_operation);
m_current_change_operation = nullptr;
m_current_change_operation_index = new_change_operation_index;
}
m_current_change_operation = nullptr;
}
}
void Buffer::apply_change_operation(const ChangeOperation & change_operation, bool forward)