From cac339a9f28cbfa84a47d2d9afcf36b9e0fb37c8 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 11 Jan 2017 22:28:50 -0500 Subject: [PATCH] do not store a change operation with no change units --- src/core/Buffer.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/Buffer.cc b/src/core/Buffer.cc index a6e18b0..c3529cd 100644 --- a/src/core/Buffer.cc +++ b/src/core/Buffer.cc @@ -354,14 +354,17 @@ void Buffer::save_current_operation() { if (m_current_change_operation) { - size_t new_change_operation_index = m_change_operations.size(); - if (m_current_change_operation_index < new_change_operation_index) + if (m_current_change_operation->changes.size() > 0u) { - 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_index = new_change_operation_index; } }