[FixDialogsOnOneLine] - Cache line count.

This commit is contained in:
Ivandro Ismael 2016-11-19 22:31:33 +00:00
parent f0ae1acb82
commit 2db5dfbe9d

View File

@ -175,7 +175,8 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
var idx = text.IndexOfAny(EndPlusDashList, StringComparison.Ordinal); var idx = text.IndexOfAny(EndPlusDashList, StringComparison.Ordinal);
if (idx >= 0) if (idx >= 0)
{ {
if (Utilities.GetNumberOfLines(text) == 2) int lineCount = Utilities.GetNumberOfLines(text);
if (lineCount == 2)
{ {
string temp = Utilities.AutoBreakLine(text, 99, 33, language); string temp = Utilities.AutoBreakLine(text, 99, 33, language);
var arr = text.SplitToLines(); var arr = text.SplitToLines();
@ -188,7 +189,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
text = temp; text = temp;
} }
} }
else if (Utilities.GetNumberOfLines(text) == 1) else if (lineCount == 1)
{ {
string temp = Utilities.AutoBreakLine(text, language); string temp = Utilities.AutoBreakLine(text, language);
var arrTemp = temp.SplitToLines(); var arrTemp = temp.SplitToLines();