diff --git a/app/node/output/track/track.cpp b/app/node/output/track/track.cpp index 10f640d3a..41eda30f2 100644 --- a/app/node/output/track/track.cpp +++ b/app/node/output/track/track.cpp @@ -325,6 +325,10 @@ Block *Track::NearestBlockBefore(const rational &time) const { foreach (Block* block, blocks_) { // Blocks are sorted by time, so the first Block who's out point is at/after this time is the correct Block + if (block->in() == time) { + break; + } + if (block->out() >= time) { return block; } diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index cab49be8c..3416f6e05 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -1368,7 +1368,7 @@ QVector TimelineWidget::GetEditToInfo(const rational& play QVector info_list(tracks.size()); for (int i=0;i TimelineWidget::GetEditToInfo(const rational& play } info.nearest_block = b; - - info_list[i] = info; } return info_list; @@ -1415,7 +1413,7 @@ void TimelineWidget::RippleTo(Timeline::MovementMode mode) } // Find each track's nearest point and determine the overall timeline's nearest point - rational closest_point_to_playhead = (mode == Timeline::kTrimIn) ? 0 : RATIONAL_MAX; + rational closest_point_to_playhead = (mode == Timeline::kTrimIn) ? RATIONAL_MIN : RATIONAL_MAX; foreach (const Timeline::EditToInfo& info, tracks) { if (info.nearest_block) { @@ -1427,6 +1425,11 @@ void TimelineWidget::RippleTo(Timeline::MovementMode mode) } } + if (closest_point_to_playhead == RATIONAL_MIN || closest_point_to_playhead == RATIONAL_MAX) { + // Assume no blocks will be acted upon + return; + } + // If we're not inserting gaps and the edit point is right on the nearest in point, we enter a // single-frame mode where we remove one frame only if (closest_point_to_playhead == playhead_time) {