diff --git a/libse/Forms/RemoveTextForHI.cs b/libse/Forms/RemoveTextForHI.cs index c6c79ee15..6bfae9ddf 100644 --- a/libse/Forms/RemoveTextForHI.cs +++ b/libse/Forms/RemoveTextForHI.cs @@ -200,7 +200,9 @@ namespace Nikse.SubtitleEdit.Core.Forms string l1Trimmed = HtmlUtil.RemoveHtmlTags(lines[0]).TrimEnd('"'); if (count == 1 && lines.Length == 2 && !l1Trimmed.EndsWith('.') && !l1Trimmed.EndsWith('!') && - !l1Trimmed.EndsWith('?')) + !l1Trimmed.EndsWith('?') && + !l1Trimmed.EndsWith("--", StringComparison.Ordinal) && + !l1Trimmed.EndsWith("—", StringComparison.Ordinal)) { remove = false; } @@ -343,7 +345,7 @@ namespace Nikse.SubtitleEdit.Core.Forms if (insertDash) { string arr0QuoteTrimmed = arr[0].TrimEnd('"'); - if (arr0QuoteTrimmed.Length > 0 && !".?!".Contains(arr0QuoteTrimmed[arr0QuoteTrimmed.Length - 1]) && !arr0QuoteTrimmed.EndsWith("", StringComparison.Ordinal)) + if (arr0QuoteTrimmed.Length > 0 && !".?!".Contains(arr0QuoteTrimmed[arr0QuoteTrimmed.Length - 1]) && !arr0QuoteTrimmed.EndsWith("", StringComparison.Ordinal) && !arr0QuoteTrimmed.EndsWith("--", StringComparison.Ordinal) && !arr0QuoteTrimmed.EndsWith("—", StringComparison.Ordinal)) { if (!arr1Stripable.Pre.Contains('-')) { diff --git a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs index 1bae15f68..1bf305fa1 100644 --- a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs +++ b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs @@ -1554,6 +1554,21 @@ namespace Test.Logic.Forms Assert.AreEqual(expected, actual); } + [TestMethod] + public void RemoveColonTestDash() + { + RemoveTextForHI target = GetRemoveTextForHiLib(); + target.Settings.RemoveIfAllUppercase = false; + target.Settings.RemoveTextBeforeColon = true; + target.Settings.OnlyIfInSeparateLine = false; + target.Settings.OnlyIfInSeparateLine = false; + target.Settings.ColonSeparateLine = false; + target.Settings.RemoveTextBeforeColonOnlyUppercase = false; + string text = "- I have a theory, captain--" + Environment.NewLine + "UHURA: Captain Kirk."; + string expected = "- I have a theory, captain--" + Environment.NewLine + "- Captain Kirk."; ; + string actual = target.RemoveColon(text); + Assert.AreEqual(expected, actual); + } #region Additional test attributes