Fix for auto br line / French - thx Norbert :)

This commit is contained in:
niksedk 2021-06-21 15:34:50 +02:00
parent 14ccc6960e
commit 6026ab6989
2 changed files with 20 additions and 2 deletions

View File

@ -64,6 +64,15 @@ namespace Test.Logic
Assert.AreEqual(s1, s2);
}
[TestMethod]
public void AutoBreakFrenchSpaceBeforePunctuation()
{
Configuration.Settings.General.SubtitleLineMaximumLength = 43;
string s1 = "Et elle te le dis maintenant ? Pour quoi donc ?";
string s2 = Utilities.AutoBreakLine(s1, "fr");
Assert.AreEqual("Et elle te le dis maintenant ?" + Environment.NewLine + "Pour quoi donc ?", s2);
}
[TestMethod]
public void AutoBreakLine5DoNoBreakAtTwoMusicTaggedLines()
{
@ -443,7 +452,7 @@ namespace Test.Logic
{
var s1 = "<i<Hallo!<i/>";
string s2 = HtmlUtil.FixInvalidItalicTags(s1);
Assert.AreEqual( "<i>Hallo!</i>", s2);
Assert.AreEqual("<i>Hallo!</i>", s2);
}
[TestMethod]
@ -717,7 +726,7 @@ namespace Test.Logic
public void RemoveLineBreaks5()
{
string result = Utilities.RemoveLineBreaks("<i>Foobar" + Environment.NewLine + "</i>");
Assert.AreEqual( "<i>Foobar</i>", result);
Assert.AreEqual("<i>Foobar</i>", result);
}
[TestMethod]

View File

@ -248,6 +248,15 @@ namespace Nikse.SubtitleEdit.Core.Common
return false;
}
if (nextChar == ' ' && language == "fr" && index + 1 < s.Length)
{
var nextNext = s[index + 1];
if (nextNext == '?' || nextNext == '!' || nextNext == '.')
{
return false;
}
}
return true;
}