commit 743533567b891e5cbce8bfcde03ae01ab54d0e8f
parent d5c10bffe123589552b36f44cb348cda781a5912
Author: deurzen <m.deurzen@tum.de>
Date: Tue, 31 Aug 2021 06:47:10 +0200
fixes bug in cycle index adjustment
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/core/cycle.t.hh b/src/core/cycle.t.hh
@@ -353,13 +353,18 @@ template <typename T>
bool
Cycle<T>::remove_element(T element)
{
+ std::optional<Index> index = index_of_element(element);
bool must_resync = is_active_element(element);
std::size_t size_before = m_elements.size();
+
Util::erase_remove(m_elements, element);
m_stack.remove(element);
+ if (m_index != 0 && index && m_index >= *index)
+ --m_index;
+
if (must_resync)
sync_active();