mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Fix hang in "FCE Remove unneeded spaces" - thx Zoltán :)
Just in time for #4131 :)
This commit is contained in:
parent
44cafe557f
commit
ff7c17ecb5
@ -2093,7 +2093,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
while (text.Contains(" ?</i>" + Environment.NewLine))
|
||||
{
|
||||
text = text.Replace(" !</i>" + Environment.NewLine, "!</i>" + Environment.NewLine);
|
||||
text = text.Replace(" ?</i>" + Environment.NewLine, "?</i>" + Environment.NewLine);
|
||||
}
|
||||
|
||||
if (text.StartsWith("- ... ", StringComparison.Ordinal))
|
||||
|
@ -1156,7 +1156,7 @@ namespace Test.FixCommonErrors
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixUnneededSpacesBeforeEndTag()
|
||||
public void FixUnneededSpacesBeforeEndTag1()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
@ -1166,6 +1166,30 @@ namespace Test.FixCommonErrors
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixUnneededSpacesBeforeEndTag1b()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "<i>I happen to have" + Environment.NewLine + " the blood of an ancient family !</i>");
|
||||
new FixUnneededSpaces().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("<i>I happen to have" + Environment.NewLine + "the blood of an ancient family!</i>", _subtitle.Paragraphs[0].Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void FixUnneededSpacesBeforeEndTag1c()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "<i>I happen to have" + Environment.NewLine + " the blood of an ancient family ?</i>");
|
||||
new FixUnneededSpaces().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("<i>I happen to have" + Environment.NewLine + "the blood of an ancient family?</i>", _subtitle.Paragraphs[0].Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void FixUnneededSpacesBeforeEndTag2()
|
||||
{
|
||||
@ -1177,6 +1201,28 @@ namespace Test.FixCommonErrors
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixUnneededSpacesBeforeEndTag2a()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "<i>I happen to have to! </i>" + Environment.NewLine + "Right?");
|
||||
new FixUnneededSpaces().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("<i>I happen to have to!</i>" + Environment.NewLine + "Right?", _subtitle.Paragraphs[0].Text);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FixUnneededSpacesBeforeEndTag2b()
|
||||
{
|
||||
using (var target = GetFixCommonErrorsLib())
|
||||
{
|
||||
InitializeFixCommonErrorsLine(target, "<i>I happen to have to? </i>" + Environment.NewLine + "Right?");
|
||||
new FixUnneededSpaces().Fix(_subtitle, new EmptyFixCallback());
|
||||
Assert.AreEqual("<i>I happen to have to?</i>" + Environment.NewLine + "Right?", _subtitle.Paragraphs[0].Text);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Fix unneeded spaces
|
||||
|
||||
#region Fix EmptyLines
|
||||
|
Loading…
Reference in New Issue
Block a user