mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 11:42:36 +01:00
26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
|
{
|
|
public class FixShortLines : IFixCommonError
|
|
{
|
|
public void Fix(Subtitle subtitle, IFixCallbacks callbacks)
|
|
{
|
|
var language = Configuration.Settings.Language.FixCommonErrors;
|
|
string fixAction = language.MergeShortLine;
|
|
int noOfShortLines = 0;
|
|
for (int i = 0; i < subtitle.Paragraphs.Count; i++)
|
|
{
|
|
Paragraph p = subtitle.Paragraphs[i];
|
|
string oldText = p.Text;
|
|
var text = Helper.FixShortLines(p.Text);
|
|
if (callbacks.AllowFix(p, fixAction) && oldText != text)
|
|
{
|
|
p.Text = text;
|
|
noOfShortLines++;
|
|
callbacks.AddFixToListView(p, fixAction, oldText, p.Text);
|
|
}
|
|
}
|
|
callbacks.UpdateFixStatus(noOfShortLines, language.RemoveLineBreaks, string.Format(language.XLinesUnbreaked, noOfShortLines));
|
|
}
|
|
}
|
|
}
|