diff --git a/src/Logic/Utilities.cs b/src/Logic/Utilities.cs index 23b898457..f329d6f7e 100644 --- a/src/Logic/Utilities.cs +++ b/src/Logic/Utilities.cs @@ -2352,6 +2352,10 @@ namespace Nikse.SubtitleEdit.Logic else text = text.Substring(0, lastIndex - 1) + endTag; } + if (text.StartsWith("") && text.EndsWith("") && text.Contains("" + Environment.NewLine + "")) + { + text = text.Replace("" + Environment.NewLine + "", Environment.NewLine); + } } if (italicBeginTagCount == 1 && italicEndTagCount == 0) diff --git a/src/SubtitleEdit.sln b/src/SubtitleEdit.sln index 7b8ef1cd2..58805a1d7 100644 --- a/src/SubtitleEdit.sln +++ b/src/SubtitleEdit.sln @@ -9,6 +9,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E}" +EndProject Global GlobalSection(SubversionScc) = preSolution Svn-Managed = True @@ -26,6 +28,10 @@ Global {511A5B59-1C35-4719-8536-23B19AF9B21A}.Debug|Any CPU.Build.0 = Debug|Any CPU {511A5B59-1C35-4719-8536-23B19AF9B21A}.Release|Any CPU.ActiveCfg = Release|Any CPU {511A5B59-1C35-4719-8536-23B19AF9B21A}.Release|Any CPU.Build.0 = Release|Any CPU + {7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7BE5B8E8-9469-4C7C-89D7-E8C884DEFC0E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Test/FixCommonErrorsTest.cs b/src/Test/FixCommonErrorsTest.cs index efeb3cd6e..87b42a1ca 100644 --- a/src/Test/FixCommonErrorsTest.cs +++ b/src/Test/FixCommonErrorsTest.cs @@ -255,6 +255,16 @@ namespace Test Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "What do i care."); } + [TestMethod] + [DeploymentItem("SubtitleEdit.exe")] + public void FixItalicsLine1BadEndingDouble() + { + var target = new FixCommonErrors_Accessor(); + InitializeFixCommonErrorsLine(target, "To be a life-changing weekend" + Environment.NewLine + "for all of us."); + target.FixInvalidItalicTags(); + Assert.AreEqual(target._subtitle.Paragraphs[0].Text, "To be a life-changing weekend" + Environment.NewLine + "for all of us."); + } + #endregion #region Fix Missing Periods At End Of Line @@ -374,7 +384,6 @@ namespace Test } #endregion - #region Fix missingspaces [TestMethod] [DeploymentItem("SubtitleEdit.exe")]