From eb69579b2316d6bd1d3865d8150598fc69c9c3de Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sat, 24 Feb 2024 15:06:18 -0600 Subject: [PATCH] Fix clip left behind after two move operations The undo helper only saves info for tracks that were affected. So we can not merge two move operations if they affected different tracks. Maybe in the future we can merge the undo helpers. As reported here: https://forum.shotcut.org/t/beta-version-24-02-now-available-to-test/43064/18 --- src/commands/timelinecommands.cpp | 3 +++ src/commands/undohelper.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/commands/timelinecommands.cpp b/src/commands/timelinecommands.cpp index 64341edd83..c9abc9cb28 100644 --- a/src/commands/timelinecommands.cpp +++ b/src/commands/timelinecommands.cpp @@ -721,6 +721,9 @@ bool MoveClipCommand::mergeWith(const QUndoCommand *other) || that->m_ripple != m_ripple || that->m_rippleAllTracks != m_rippleAllTracks || that->m_rippleMarkers != m_rippleMarkers) return false; + if (that->m_undoHelper.affectedTracks() != m_undoHelper.affectedTracks()) { + return false; + } auto thisIterator = m_clips.begin(); auto thatIterator = that->m_clips.begin(); while (thisIterator != m_clips.end() && thatIterator != that->m_clips.end()) { diff --git a/src/commands/undohelper.h b/src/commands/undohelper.h index fba2e5af7d..fe61c99607 100644 --- a/src/commands/undohelper.h +++ b/src/commands/undohelper.h @@ -39,6 +39,10 @@ class UndoHelper void recordAfterState(); void undoChanges(); void setHints(OptimizationHints hints); + QSet affectedTracks() const + { + return m_affectedTracks; + } private: void debugPrintState(const QString &title);