Minor improvement for 'Fix dialogues on one line - thx David :)

This commit is contained in:
niksedk 2019-08-15 17:21:34 +02:00
parent fe30f89c5c
commit 82195a1b03
2 changed files with 10 additions and 1 deletions

View File

@ -184,7 +184,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
string part0 = noTagLines[0];
string part1 = noTagLines[1];
if (part0.Length > 1 && "-—!?.\")]".Contains(part0[part0.Length - 1]) &&
part1.Length > 1 && (char.IsUpper(part1[0]) || part1[0] == '\''))
part1.Length > 1 && (char.IsUpper(part1[0]) || "\"'{[(".Contains(part1[0])))
{
text = text.Replace(" - ", Environment.NewLine + "- ");
if (char.IsLetter((part0[0])) || CharUtils.IsDigit(part0[0]))

View File

@ -2006,6 +2006,15 @@ namespace Test
Assert.AreEqual(result, target);
}
[TestMethod]
public void FixDialogsOnOneLine5()
{
string source = "- [Gunshot] - [Scream]";
string target = "- [Gunshot]" + Environment.NewLine + "- [Scream]";
string result = Helper.FixDialogsOnOneLine(source, "en");
Assert.AreEqual(result, target);
}
#endregion Fix dialogs on one line
#region FixDoubleDash