diff --git a/libse/Forms/RemoveTextForHI.cs b/libse/Forms/RemoveTextForHI.cs
index e7b409b05..df52511a5 100644
--- a/libse/Forms/RemoveTextForHI.cs
+++ b/libse/Forms/RemoveTextForHI.cs
@@ -626,6 +626,31 @@ namespace Nikse.SubtitleEdit.Core.Forms
text = text.TrimStart().TrimStart('-').TrimStart();
}
+ string removeText = "- " + Environment.NewLine + "-";
+ if (text.StartsWith(removeText))
+ {
+ text = text.Remove(0, removeText.Length).TrimStart(' ');
+ }
+
+ removeText = "-" + Environment.NewLine + "-";
+ if (text.StartsWith(removeText))
+ {
+ text = text.Remove(0, removeText.Length).TrimStart(' ');
+ }
+
+ removeText = "-" + Environment.NewLine + "-";
+ if (text.StartsWith(removeText))
+ {
+ text = "" + text.Remove(0, removeText.Length).TrimStart(' ');
+ }
+
+ removeText = "- " + Environment.NewLine + "-";
+ if (text.StartsWith(removeText))
+ {
+ text = "" + text.Remove(0, removeText.Length).TrimStart(' ');
+ }
+
+
if (oldText != text)
{
// insert spaces before "-"
@@ -1065,6 +1090,9 @@ namespace Nikse.SubtitleEdit.Core.Forms
preAssTag = text.Substring(0, indexOfEndBracketSuccessor);
text = text.Remove(0, indexOfEndBracketSuccessor).TrimStart();
}
+ string preNewLine = string.Empty;
+ if (text.StartsWith(Environment.NewLine))
+ preNewLine = Environment.NewLine;
if (Settings.RemoveTextBetweenSquares)
{
text = RemoveTextBetweenTags("[", "]:", text);
@@ -1091,7 +1119,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
}
if (string.IsNullOrWhiteSpace(text))
return string.Empty;
- return preAssTag + text.TrimStart();
+ return preAssTag + preNewLine + text.TrimStart();
}
private bool HasHearImpairedText(string text)
diff --git a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs
index bd96a1f72..34e0def8b 100644
--- a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs
+++ b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs
@@ -1331,6 +1331,21 @@ namespace Test.Logic.Forms
Assert.AreEqual(expected, actual);
}
+ [TestMethod]
+ public void RemoveTextForHiRemoveFirstLine()
+ {
+ RemoveTextForHI target = GetRemoveTextForHiLib();
+ target.Settings.RemoveTextBetweenBrackets = true;
+ target.Settings.RemoveTextBetweenCustomTags = true;
+ target.Settings.CustomStart = "♪";
+ target.Settings.CustomEnd = "♪";
+ target.Settings.RemoveTextBetweenBrackets = true;
+ string text = "- ♪♪[Continues ]" + Environment.NewLine + "- It's pretty strong stuff.";
+ const string expected = "It's pretty strong stuff.";
+ string actual = target.RemoveTextFromHearImpaired(text);
+ Assert.AreEqual(expected, actual);
+ }
+
#region Additional test attributes
//