mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 12:44:46 +01:00
Some optimization in RemoveEmptyLines
This commit is contained in:
parent
e4d55011bf
commit
07be8bd190
@ -458,8 +458,8 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
public int RemoveEmptyLines()
|
||||
{
|
||||
int count = 0;
|
||||
if (_paragraphs.Count > 0)
|
||||
int count = _paragraphs.Count;
|
||||
if (count > 0)
|
||||
{
|
||||
int firstNumber = _paragraphs[0].Number;
|
||||
for (int i = _paragraphs.Count - 1; i >= 0; i--)
|
||||
@ -468,14 +468,12 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
string s = p.Text.Trim();
|
||||
|
||||
if (s.Length == 0)
|
||||
{
|
||||
_paragraphs.RemoveAt(i);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
Renumber(firstNumber);
|
||||
if (count != _paragraphs.Count)
|
||||
Renumber(firstNumber);
|
||||
}
|
||||
return count;
|
||||
return count - _paragraphs.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user