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
+8 -5
+8 -5
View File
@@ -354,14 +354,17 @@ void Buffer::save_current_operation()
{ {
if (m_current_change_operation) if (m_current_change_operation)
{ {
size_t new_change_operation_index = m_change_operations.size(); if (m_current_change_operation->changes.size() > 0u)
if (m_current_change_operation_index < new_change_operation_index)
{ {
m_change_operations[m_current_change_operation_index]->children.push_back(new_change_operation_index); size_t new_change_operation_index = m_change_operations.size();
if (m_current_change_operation_index < new_change_operation_index)
{
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_index = new_change_operation_index;
} }
m_change_operations.push_back(m_current_change_operation);
m_current_change_operation = nullptr; m_current_change_operation = nullptr;
m_current_change_operation_index = new_change_operation_index;
} }
} }