Merge pull request #4456 from ivandrofly/oresme

move time adjusting outside reading foreach
This commit is contained in:
Nikolaj Olsson 2020-10-27 17:22:37 +01:00 committed by GitHub
commit 0158833f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,18 +66,18 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
_errorCount++;
}
}
for (int i = 0; i < subtitle.Paragraphs.Count - 1; i++)
{
var p2 = subtitle.Paragraphs[i];
var next = subtitle.Paragraphs[i + 1];
p2.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
}
if (subtitle.Paragraphs.Count > 0)
{
subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].EndTime.TotalMilliseconds = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime.TotalMilliseconds +
Utilities.GetOptimalDisplayMilliseconds(subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].Text);
}
for (int i = 0; i < subtitle.Paragraphs.Count - 1; i++)
{
var p = subtitle.Paragraphs[i];
var next = subtitle.Paragraphs[i + 1];
p.EndTime.TotalMilliseconds = next.StartTime.TotalMilliseconds - Configuration.Settings.General.MinimumMillisecondsBetweenLines;
}
if (subtitle.Paragraphs.Count > 0)
{
subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].EndTime.TotalMilliseconds = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime.TotalMilliseconds +
Utilities.GetOptimalDisplayMilliseconds(subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].Text);
}
subtitle.RemoveEmptyLines();
subtitle.Renumber();