diff --git a/libse/Subtitle.cs b/libse/Subtitle.cs index c8635c035..aad814206 100644 --- a/libse/Subtitle.cs +++ b/libse/Subtitle.cs @@ -325,13 +325,20 @@ namespace Nikse.SubtitleEdit.Core } } - public void RecalculateDisplayTimes(double maxCharactersPerSecond, List selectedIndexes, double optimalCharactersPerSeconds, bool extendOnly = false) + public void RecalculateDisplayTimes(double maxCharPerSec, List selectedIndexes, double optimalCharPerSec, bool extendOnly = false) { - for (int i = 0; i < _paragraphs.Count; i++) + if (selectedIndexes != null) { - if (selectedIndexes == null || selectedIndexes.Contains(i)) + foreach (var index in selectedIndexes) { - RecalculateDisplayTime(maxCharactersPerSecond, i, optimalCharactersPerSeconds, extendOnly); + RecalculateDisplayTime(maxCharPerSec, index, optimalCharPerSec, extendOnly); + } + } + else + { + for (int i = 0; i < _paragraphs.Count; i++) + { + RecalculateDisplayTime(maxCharPerSec, i, optimalCharPerSec, extendOnly); } } } @@ -371,7 +378,6 @@ namespace Nikse.SubtitleEdit.Core } } - public void SetFixedDuration(List selectedIndexes, double fixedDurationMilliseconds) { for (int i = 0; i < _paragraphs.Count; i++)