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.
This commit is contained in:
Thomas Goyne 2014-03-21 16:41:22 -07:00
parent 3e9bb94126
commit 2eb211f5b6
1 changed files with 8 additions and 6 deletions

View File

@ -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;