mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Fixed "Remove text for HI" issue reagarding colons - thx Boulder08 :)
Fix #2098
This commit is contained in:
parent
1df438a6b0
commit
73daa1d1a1
@ -102,7 +102,8 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
foreach (string line in lines)
|
||||
{
|
||||
int indexOfColon = line.IndexOf(':');
|
||||
if (indexOfColon <= 0 || IsInsideBrackets(line, indexOfColon))
|
||||
bool isLastColon = count == lines.Length - 1 && !HtmlUtil.RemoveHtmlTags(line).TrimEnd(':').Contains(':');
|
||||
if (indexOfColon <= 0 || IsInsideBrackets(line, indexOfColon) || (isLastColon && Utilities.CountTagInText(HtmlUtil.RemoveHtmlTags(line), ' ') > 1))
|
||||
{
|
||||
newText = (newText + Environment.NewLine + line).Trim();
|
||||
|
||||
|
@ -1576,6 +1576,29 @@ namespace Test.Logic.Forms
|
||||
Assert.AreEqual("Ferguson, Kaz...", actual);
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveFirstLineOfTwoColons1()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.Settings.RemoveTextBetweenSquares = true;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||
string actual = target.RemoveTextFromHearImpaired("KIRK:" + Environment.NewLine + "<i>Captain's log, stardate 1514. 1:</i>");
|
||||
Assert.AreEqual("<i>Captain's log, stardate 1514. 1:</i>", actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveFirstLineOfTwoColons2()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.Settings.RemoveTextBetweenSquares = true;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBetweenCustomTags = false;
|
||||
string actual = target.RemoveTextFromHearImpaired("KIRK:" + Environment.NewLine + "Captain's log, stardate 1514. 1:");
|
||||
Assert.AreEqual("Captain's log, stardate 1514. 1:", actual);
|
||||
}
|
||||
|
||||
#region Additional test attributes
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user