From 5d88099601e86139f07683978fa4b568bb3da635 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sat, 20 Jun 2020 10:39:23 +0200 Subject: [PATCH] Fix (probably extremely rare) missing space before $ - thx Aleksander :) --- libse/Forms/FixCommonErrors/FixMissingSpaces.cs | 2 +- src/Test/FixCommonErrors/FixCommonErrorsTest.cs | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libse/Forms/FixCommonErrors/FixMissingSpaces.cs b/libse/Forms/FixCommonErrors/FixMissingSpaces.cs index ad83a9a37..baf4e79c9 100644 --- a/libse/Forms/FixCommonErrors/FixMissingSpaces.cs +++ b/libse/Forms/FixCommonErrors/FixMissingSpaces.cs @@ -276,7 +276,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors { if (newText.Length > index + 4 && index >= 1) { - if (Utilities.AllLettersAndNumbers.Contains(newText[index + 3]) && + if ((Utilities.AllLettersAndNumbers + "$").Contains(newText[index + 3]) && Utilities.AllLettersAndNumbers.Contains(newText[index - 1])) { newText = newText.Insert(index + 3, " "); diff --git a/src/Test/FixCommonErrors/FixCommonErrorsTest.cs b/src/Test/FixCommonErrors/FixCommonErrorsTest.cs index f0bfade89..3aa6b5e9c 100644 --- a/src/Test/FixCommonErrors/FixCommonErrorsTest.cs +++ b/src/Test/FixCommonErrors/FixCommonErrorsTest.cs @@ -707,6 +707,17 @@ namespace Test.FixCommonErrors } } + [TestMethod] + public void FixMissingSpacesAfterThreeDotsBeforeDollarSign() + { + using (var target = GetFixCommonErrorsLib()) + { + InitializeFixCommonErrorsLine(target, "Give me...$20!"); + new FixMissingSpaces().Fix(_subtitle, new EmptyFixCallback { Language = "en" }); + Assert.AreEqual("Give me... $20!", _subtitle.Paragraphs[0].Text); + } + } + [TestMethod] public void FixMissingSwedish() {