From 2eb211f5b6011a1dbe92e1733c7678853d59194a Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 21 Mar 2014 16:41:22 -0700 Subject: [PATCH] Fix issues with showing the previous inactive line The "previous" line for the first line was actually the last line of the file, and the previous line for the second line was ignored entirely. Closes #1719. --- src/audio_timing_dialogue.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/audio_timing_dialogue.cpp b/src/audio_timing_dialogue.cpp index d3edd11f2..8594cb614 100644 --- a/src/audio_timing_dialogue.cpp +++ b/src/audio_timing_dialogue.cpp @@ -739,10 +739,13 @@ void AudioTimingControllerDialogue::RegenerateInactiveLines() if (current_line == context->ass->Events.end()) break; - auto prev = current_line; - while (--prev != context->ass->Events.begin() && !predicate(*prev)) ; - if (prev != context->ass->Events.begin()) - AddInactiveLine(sel, &*prev); + if (current_line != context->ass->Events.begin()) + { + auto prev = current_line; + while (--prev != context->ass->Events.begin() && !predicate(*prev)) ; + if (predicate(*prev)) + AddInactiveLine(sel, &*prev); + } if (mode == 2) { @@ -789,8 +792,7 @@ void AudioTimingControllerDialogue::RegenerateSelectedLines() selected_lines.clear(); AssDialogue *active = context->selectionController->GetActiveLine(); - SubtitleSelection const& sel = context->selectionController->GetSelectedSet(); - for (auto line : sel) + for (auto line : context->selectionController->GetSelectedSet()) { if (line == active) continue;