diff --git a/src/Logic/Forms/RemoveTextForHI.cs b/src/Logic/Forms/RemoveTextForHI.cs index b45aabb06..5c547f965 100644 --- a/src/Logic/Forms/RemoveTextForHI.cs +++ b/src/Logic/Forms/RemoveTextForHI.cs @@ -272,7 +272,8 @@ namespace Nikse.SubtitleEdit.Logic.Forms insertDash = false; } - if (arr0.Length > 0 && arr1.Length > 1 && !(arr[0].EndsWith('.') || arr[0].EndsWith('!') || arr[0].EndsWith('?') || arr[0].EndsWith("", StringComparison.Ordinal)) && + string tempArr0QuoteTrimmed = arr[0].TrimEnd('"'); + if (arr0.Length > 0 && arr1.Length > 1 && !(tempArr0QuoteTrimmed.EndsWith('.') || tempArr0QuoteTrimmed.EndsWith('!') || tempArr0QuoteTrimmed.EndsWith('?') || tempArr0QuoteTrimmed.EndsWith("", StringComparison.Ordinal)) && !(new StripableText(arr[1]).Pre.Contains('-'))) { insertDash = false; diff --git a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs index 0e906045a..1a216699e 100644 --- a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs +++ b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs @@ -1166,7 +1166,6 @@ namespace Test.Logic.Forms } [TestMethod] - [DeploymentItem("SubtitleEdit.exe")] public void RemoveTextSpeakerWithColonPlusLineWithHyphenAlsoRemoveInterjections() { RemoveTextForHI target = GetRemoveTextForHiLib(); @@ -1179,6 +1178,34 @@ namespace Test.Logic.Forms Assert.AreEqual(expected, actual); } + [TestMethod] + public void RemoveTextQuotesInFirstLine() + { + RemoveTextForHI target = GetRemoveTextForHiLib(); + target.Settings.RemoveTextBeforeColon = true; + target.Settings.RemoveTextBeforeColonOnlyUppercase = false; + target.Settings.RemoveInterjections = true; + string text = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "EAMES: Exactly."; + string expected = "- \"My father doesn't want me to be him.\"" + Environment.NewLine + "- Exactly."; + string actual = target.RemoveTextFromHearImpaired(text); + Assert.AreEqual(expected, actual); + } + + [TestMethod] + public void RemoveTextQuotesInFirstLine2() + { + RemoveTextForHI target = GetRemoveTextForHiLib(); + target.Settings.RemoveIfAllUppercase = false; + target.Settings.RemoveInterjections = true; + target.Settings.OnlyIfInSeparateLine = false; + target.Settings.RemoveTextBeforeColonOnlyUppercase = false; + target.Settings.ColonSeparateLine = false; + string text = "- \"Ballpark.\"" + Environment.NewLine + "-Hmm."; + const string expected = "\"Ballpark.\""; + string actual = target.RemoveInterjections(text); + Assert.AreEqual(expected, actual); + } + #region Additional test attributes //