From bbed109adbec204e9ef52b0a8c5ebb5fb9b91aa2 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Mon, 11 Aug 2014 18:08:39 +0200 Subject: [PATCH] Minor fix in Fix common errors - Fix missing period... thx Joel :) --- src/Forms/FixCommonErrors.cs | 3 ++- src/Test/FixCommonErrorsTest.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Forms/FixCommonErrors.cs b/src/Forms/FixCommonErrors.cs index c4176edd8..dd4c5e3e0 100644 --- a/src/Forms/FixCommonErrors.cs +++ b/src/Forms/FixCommonErrors.cs @@ -2071,8 +2071,9 @@ namespace Nikse.SubtitleEdit.Forms tempNoHtml.Length > 0 && (!",.!?:;>-])♪♫…".Contains(tempNoHtml[tempNoHtml.Length - 1].ToString()))) { + string tempTrimmed = tempNoHtml.TrimEnd().TrimEnd(new char[] { '\'', '"', '“', '”' }).TrimEnd(); if (!tempNoHtml.EndsWith(")") && !tempNoHtml.EndsWith("]") && !tempNoHtml.EndsWith("*") && !tempNoHtml.EndsWith("#") && !tempNoHtml.EndsWith("¶") && // hear impaired - !tempNoHtml.EndsWith(".\"") && !tempNoHtml.EndsWith("!\"") && !tempNoHtml.EndsWith("?\"") && !tempNoHtml.EndsWith(".“") && !tempNoHtml.EndsWith(".”")) + !tempTrimmed.EndsWith(".") && !tempTrimmed.EndsWith("!") && !tempTrimmed.EndsWith("?")) { if (p.Text != p.Text.ToUpper()) { diff --git a/src/Test/FixCommonErrorsTest.cs b/src/Test/FixCommonErrorsTest.cs index a24b50c94..a9d8e51dd 100644 --- a/src/Test/FixCommonErrorsTest.cs +++ b/src/Test/FixCommonErrorsTest.cs @@ -312,6 +312,17 @@ namespace Test target.FixMissingPeriodsAtEndOfLine(); Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "This is line one!" + Environment.NewLine + "Boy."); } + + [TestMethod] + [DeploymentItem("SubtitleEdit.exe")] + public void FixMissingPeriodsAtEndOfLineWithSpace() + { + var target = GetFixCommonErrorsLib(); + InitializeFixCommonErrorsLine(target, "”... and gently down I laid her. ”"); + target.FixMissingPeriodsAtEndOfLine(); + Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "”... and gently down I laid her. ”"); + } + #endregion #region Fix Hyphens (add dash)