More settings for auto-br

This commit is contained in:
Nikolaj Olsson 2019-11-05 19:09:02 +01:00
parent 884ab20901
commit 2eb3909454
9 changed files with 147 additions and 55 deletions

View File

@ -2073,7 +2073,10 @@ can edit in same subtitle file (collaboration)</Information>
<MainFileSaveAll>Save all</MainFileSaveAll>
<Miscellaneous>Misc.</Miscellaneous>
<CpsIncludesSpace>Chars/sec (CPS) includes spaces</CpsIncludesSpace>
<UseDoNotBreakAfterList>Use do-not-break-after list (for auto-br)</UseDoNotBreakAfterList>
<UseDoNotBreakAfterList>Use do-not-break-after list</UseDoNotBreakAfterList>
<BreakEarlyForLineEnding>Break early for line ending (.!?)</BreakEarlyForLineEnding>
<BreakEarlyForDashDialog>Break early for dialog dash</BreakEarlyForDashDialog>
<BreakEarlyForComma>Break early for comma</BreakEarlyForComma>
<GoogleTranslate>Google Translate</GoogleTranslate>
<GoogleTranslateApiKey>API key</GoogleTranslateApiKey>
<MicrosoftBingTranslator>Microsoft Translator</MicrosoftBingTranslator>

View File

@ -2366,7 +2366,10 @@ can edit in same subtitle file (collaboration)",
MainTextBoxUnbreak = "Unbreak text",
MainFileSaveAll = "Save all",
Miscellaneous = "Misc.",
UseDoNotBreakAfterList = "Use do-not-break-after list (for auto-br)",
UseDoNotBreakAfterList = "Use do-not-break-after list",
BreakEarlyForComma = "Break early for comma",
BreakEarlyForDashDialog = "Break early for dialog dash",
BreakEarlyForLineEnding = "Break early for line ending (.!?)",
GoogleTranslate = "Google Translate",
GoogleTranslateApiKey = "API key",
CpsIncludesSpace = "Chars/sec (CPS) includes spaces",

View File

@ -5644,6 +5644,15 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/UseDoNotBreakAfterList":
language.Settings.UseDoNotBreakAfterList = reader.Value;
break;
case "Settings/BreakEarlyForLineEnding":
language.Settings.BreakEarlyForLineEnding = reader.Value;
break;
case "Settings/BreakEarlyForDashDialog":
language.Settings.BreakEarlyForDashDialog = reader.Value;
break;
case "Settings/BreakEarlyForComma":
language.Settings.BreakEarlyForComma = reader.Value;
break;
case "Settings/GoogleTranslate":
language.Settings.GoogleTranslate = reader.Value;
break;

View File

@ -2240,6 +2240,9 @@
public string Miscellaneous { get; set; }
public string CpsIncludesSpace { get; set; }
public string UseDoNotBreakAfterList { get; set; }
public string BreakEarlyForLineEnding { get; set; }
public string BreakEarlyForDashDialog { get; set; }
public string BreakEarlyForComma { get; set; }
public string GoogleTranslate { get; set; }
public string GoogleTranslateApiKey { get; set; }
public string MicrosoftBingTranslator { get; set; }

View File

@ -245,6 +245,8 @@ namespace Nikse.SubtitleEdit.Core
public string AdjustDurationLast { get; set; }
public bool AdjustDurationExtendOnly { get; set; }
public bool AutoBreakCommaBreakEarly { get; set; }
public bool AutoBreakDashEarly { get; set; }
public bool AutoBreakLineEndingEarly { get; set; }
public bool ApplyMinimumDurationLimit { get; set; }
public bool ApplyMaximumDurationLimit { get; set; }
@ -344,7 +346,9 @@ namespace Nikse.SubtitleEdit.Core
AdjustDurationSeconds = 0.1m;
AdjustDurationPercent = 120;
AdjustDurationExtendOnly = true;
AutoBreakCommaBreakEarly = true;
AutoBreakCommaBreakEarly = false;
AutoBreakDashEarly = true;
AutoBreakLineEndingEarly = false;
ApplyMinimumDurationLimit = true;
ApplyMaximumDurationLimit = true;
}
@ -3490,6 +3494,18 @@ $HorzAlign = Center
settings.Tools.AutoBreakCommaBreakEarly = Convert.ToBoolean(subNode.InnerText);
}
subNode = node.SelectSingleNode("AutoBreakDashEarly");
if (subNode != null)
{
settings.Tools.AutoBreakDashEarly = Convert.ToBoolean(subNode.InnerText);
}
subNode = node.SelectSingleNode("AutoBreakLineEndingEarly");
if (subNode != null)
{
settings.Tools.AutoBreakLineEndingEarly = Convert.ToBoolean(subNode.InnerText);
}
subNode = node.SelectSingleNode("ApplyMinimumDurationLimit");
if (subNode != null)
{
@ -6222,6 +6238,8 @@ $HorzAlign = Center
textWriter.WriteElementString("AdjustDurationLast", settings.Tools.AdjustDurationLast);
textWriter.WriteElementString("AdjustDurationExtendOnly", settings.Tools.AdjustDurationExtendOnly.ToString());
textWriter.WriteElementString("AutoBreakCommaBreakEarly", settings.Tools.AutoBreakCommaBreakEarly.ToString());
textWriter.WriteElementString("AutoBreakDashEarly", settings.Tools.AutoBreakDashEarly.ToString());
textWriter.WriteElementString("AutoBreakLineEndingEarly", settings.Tools.AutoBreakLineEndingEarly.ToString());
textWriter.WriteElementString("ApplyMinimumDurationLimit", settings.Tools.ApplyMinimumDurationLimit.ToString());
textWriter.WriteElementString("ApplyMaximumDurationLimit", settings.Tools.ApplyMaximumDurationLimit.ToString());

View File

@ -465,7 +465,7 @@ namespace Nikse.SubtitleEdit.Core
return text;
}
// do not autobreak dialogs or music symbol
// do not auto break dialogs or music symbol
if (text.Contains(Environment.NewLine) && (text.Contains('-') || text.Contains('♪')))
{
var noTagLines = HtmlUtil.RemoveHtmlTags(text, true).SplitToLines();
@ -570,7 +570,7 @@ namespace Nikse.SubtitleEdit.Core
int mid = s.Length / 2;
// try to find " - " with uppercase letter after (dialog)
if (s.Contains(" - "))
if (s.Contains(" - ") && Configuration.Settings.Tools.AutoBreakDashEarly)
{
for (int j = 0; j <= (maximumLength / 2) + 5; j++)
{
@ -618,11 +618,11 @@ namespace Nikse.SubtitleEdit.Core
splitPos = -1;
}
if (splitPos < 0)
if (splitPos < 0 && Configuration.Settings.Tools.AutoBreakLineEndingEarly)
{
const string expectedChars1 = ".!?0123456789";
const string expectedChars2 = ".!?";
for (int j = 0; j < 15; j++)
for (int j = 0; j < s.Length / 5; j++)
{
if (mid + j + 1 < s.Length && mid + j > 0)
{
@ -630,7 +630,7 @@ namespace Nikse.SubtitleEdit.Core
{
splitPos = mid + j + 1;
if (expectedChars1.Contains(s[splitPos]))
{ // do not break double/tripple end lines like "!!!" or "..."
{ // do not break double/triple end lines like "!!!" or "..."
splitPos++;
if (expectedChars1.Contains(s[mid + j + 1]))
{
@ -662,35 +662,32 @@ namespace Nikse.SubtitleEdit.Core
}
// prefer comma
if (Configuration.Settings.Tools.AutoBreakCommaBreakEarly)
if (splitPos < 0 && Configuration.Settings.Tools.AutoBreakCommaBreakEarly)
{
if (splitPos < 0)
const string expectedChars1 = ".!?0123456789";
const string expectedChars2 = ",";
for (int j = 0; j < s.Length / 5; j++)
{
const string expectedChars1 = ".!?0123456789";
const string expectedChars2 = ",";
for (int j = 0; j < 15; j++)
if (mid + j + 1 < s.Length && mid + j > 0)
{
if (mid + j + 1 < s.Length && mid + j > 0)
if (expectedChars2.Contains(s[mid + j]) && !IsPartOfNumber(s, mid + j) && CanBreak(s, mid + j + 1, language))
{
if (expectedChars2.Contains(s[mid + j]) && !IsPartOfNumber(s, mid + j) && CanBreak(s, mid + j + 1, language))
{
splitPos = mid + j + 1;
if (expectedChars1.Contains(s[splitPos]))
{ // do not break double/tripple end lines like "!!!" or "..."
splitPos++;
if (expectedChars1.Contains(s[mid + j + 1]))
{
splitPos++;
}
}
break;
}
if (expectedChars2.Contains(s[mid - j]) && !IsPartOfNumber(s, mid - j) && CanBreak(s, mid - j + 1, language))
{
splitPos = mid - j;
splitPos = mid + j + 1;
if (expectedChars1.Contains(s[splitPos]))
{ // do not break double/triple end lines like "!!!" or "..."
splitPos++;
break;
if (expectedChars1.Contains(s[mid + j + 1]))
{
splitPos++;
}
}
break;
}
if (expectedChars2.Contains(s[mid - j]) && !IsPartOfNumber(s, mid - j) && CanBreak(s, mid - j + 1, language))
{
splitPos = mid - j;
splitPos++;
break;
}
}
}
@ -710,10 +707,10 @@ namespace Nikse.SubtitleEdit.Core
if (splitPos < 0)
{
const string expectedChars1 = ".!?…, ";
const string expectedChars1 = ".!?… ";
const string expectedChars2 = " .!?";
const string expectedChars3 = ".!?";
for (int j = 0; j < 25; j++)
for (int j = 0; j < 15; j++)
{
if (mid + j + 1 < s.Length && mid + j > 0)
{
@ -782,13 +779,17 @@ namespace Nikse.SubtitleEdit.Core
{
s = secondSplit;
}
else if (secondLinesMax <= maximumLength && CanBreak(s, lastSpaceIndex, language) &&
else if (Configuration.Settings.Tools.AutoBreakLineEndingEarly &&
secondLinesMax <= firstLinesMax -5 &&
secondLinesMax <= maximumLength && CanBreak(s, lastSpaceIndex, language) &&
!firstLine.EndsWith(".") && !firstLine.EndsWith("!") && !firstLine.EndsWith("?") &&
(secondFirstLine.EndsWith(".") || secondFirstLine.EndsWith("!") || secondFirstLine.EndsWith("?")))
{
s = secondSplit;
}
else if (secondLinesMax <= maximumLength && CanBreak(s, lastSpaceIndex, language) &&
else if (Configuration.Settings.Tools.AutoBreakLineEndingEarly &&
secondLinesMax <= firstLinesMax - 5 &&
secondLinesMax <= maximumLength && CanBreak(s, lastSpaceIndex, language) &&
!firstLine.EndsWith(".") && !firstLine.EndsWith("!") && !firstLine.EndsWith("?") && !firstLine.EndsWith(",") &&
secondFirstLine.EndsWith(","))
{

View File

@ -205,7 +205,9 @@
this.textBoxBingClientSecret = new System.Windows.Forms.TextBox();
this.linkLabelBingSubscribe = new System.Windows.Forms.LinkLabel();
this.label1 = new System.Windows.Forms.Label();
this.groupBoxToolsMisc = new System.Windows.Forms.GroupBox();
this.groupBoxToolsAutoBr = new System.Windows.Forms.GroupBox();
this.checkBoxToolsBreakEarlyComma = new System.Windows.Forms.CheckBox();
this.checkBoxToolsBreakEarlyDash = new System.Windows.Forms.CheckBox();
this.labelUserBingApiId = new System.Windows.Forms.Label();
this.buttonEditDoNotBreakAfterList = new System.Windows.Forms.Button();
this.checkBoxUseDoNotBreakAfterList = new System.Windows.Forms.CheckBox();
@ -358,6 +360,7 @@
this.colorDialogSSAStyle = new System.Windows.Forms.ColorDialog();
this.labelStatus = new System.Windows.Forms.Label();
this.openFileDialogFFmpeg = new System.Windows.Forms.OpenFileDialog();
this.checkBoxToolsBreakEarlyLineEnding = new System.Windows.Forms.CheckBox();
this.tabControlSettings.SuspendLayout();
this.tabPageGeneral.SuspendLayout();
this.groupBoxMiscellaneous.SuspendLayout();
@ -387,7 +390,7 @@
this.tabPageTools.SuspendLayout();
this.groupBoxGoogleTranslate.SuspendLayout();
this.groupBoxBing.SuspendLayout();
this.groupBoxToolsMisc.SuspendLayout();
this.groupBoxToolsAutoBr.SuspendLayout();
this.groupBoxSpellCheck.SuspendLayout();
this.groupBoxFixCommonErrors.SuspendLayout();
this.groupBoxToolsVisualSync.SuspendLayout();
@ -2569,7 +2572,7 @@
//
this.tabPageTools.Controls.Add(this.groupBoxGoogleTranslate);
this.tabPageTools.Controls.Add(this.groupBoxBing);
this.tabPageTools.Controls.Add(this.groupBoxToolsMisc);
this.tabPageTools.Controls.Add(this.groupBoxToolsAutoBr);
this.tabPageTools.Controls.Add(this.groupBoxSpellCheck);
this.tabPageTools.Controls.Add(this.groupBoxFixCommonErrors);
this.tabPageTools.Controls.Add(this.groupBoxToolsVisualSync);
@ -2699,17 +2702,40 @@
this.label1.Size = new System.Drawing.Size(0, 13);
this.label1.TabIndex = 25;
//
// groupBoxToolsMisc
// groupBoxToolsAutoBr
//
this.groupBoxToolsMisc.Controls.Add(this.labelUserBingApiId);
this.groupBoxToolsMisc.Controls.Add(this.buttonEditDoNotBreakAfterList);
this.groupBoxToolsMisc.Controls.Add(this.checkBoxUseDoNotBreakAfterList);
this.groupBoxToolsMisc.Location = new System.Drawing.Point(421, 130);
this.groupBoxToolsMisc.Name = "groupBoxToolsMisc";
this.groupBoxToolsMisc.Size = new System.Drawing.Size(404, 108);
this.groupBoxToolsMisc.TabIndex = 5;
this.groupBoxToolsMisc.TabStop = false;
this.groupBoxToolsMisc.Text = "Misc";
this.groupBoxToolsAutoBr.Controls.Add(this.checkBoxToolsBreakEarlyLineEnding);
this.groupBoxToolsAutoBr.Controls.Add(this.checkBoxToolsBreakEarlyComma);
this.groupBoxToolsAutoBr.Controls.Add(this.checkBoxToolsBreakEarlyDash);
this.groupBoxToolsAutoBr.Controls.Add(this.labelUserBingApiId);
this.groupBoxToolsAutoBr.Controls.Add(this.buttonEditDoNotBreakAfterList);
this.groupBoxToolsAutoBr.Controls.Add(this.checkBoxUseDoNotBreakAfterList);
this.groupBoxToolsAutoBr.Location = new System.Drawing.Point(421, 6);
this.groupBoxToolsAutoBr.Name = "groupBoxToolsAutoBr";
this.groupBoxToolsAutoBr.Size = new System.Drawing.Size(404, 232);
this.groupBoxToolsAutoBr.TabIndex = 5;
this.groupBoxToolsAutoBr.TabStop = false;
this.groupBoxToolsAutoBr.Text = "Auto br";
//
// checkBoxToolsBreakEarlyComma
//
this.checkBoxToolsBreakEarlyComma.AutoSize = true;
this.checkBoxToolsBreakEarlyComma.Location = new System.Drawing.Point(15, 72);
this.checkBoxToolsBreakEarlyComma.Name = "checkBoxToolsBreakEarlyComma";
this.checkBoxToolsBreakEarlyComma.Size = new System.Drawing.Size(133, 17);
this.checkBoxToolsBreakEarlyComma.TabIndex = 27;
this.checkBoxToolsBreakEarlyComma.Text = "Break early for comma";
this.checkBoxToolsBreakEarlyComma.UseVisualStyleBackColor = true;
//
// checkBoxToolsBreakEarlyDash
//
this.checkBoxToolsBreakEarlyDash.AutoSize = true;
this.checkBoxToolsBreakEarlyDash.Location = new System.Drawing.Point(15, 49);
this.checkBoxToolsBreakEarlyDash.Name = "checkBoxToolsBreakEarlyDash";
this.checkBoxToolsBreakEarlyDash.Size = new System.Drawing.Size(123, 17);
this.checkBoxToolsBreakEarlyDash.TabIndex = 26;
this.checkBoxToolsBreakEarlyDash.Text = "Break early for dash";
this.checkBoxToolsBreakEarlyDash.UseVisualStyleBackColor = true;
//
// labelUserBingApiId
//
@ -2734,9 +2760,9 @@
this.checkBoxUseDoNotBreakAfterList.AutoSize = true;
this.checkBoxUseDoNotBreakAfterList.Location = new System.Drawing.Point(15, 26);
this.checkBoxUseDoNotBreakAfterList.Name = "checkBoxUseDoNotBreakAfterList";
this.checkBoxUseDoNotBreakAfterList.Size = new System.Drawing.Size(218, 17);
this.checkBoxUseDoNotBreakAfterList.Size = new System.Drawing.Size(154, 17);
this.checkBoxUseDoNotBreakAfterList.TabIndex = 1;
this.checkBoxUseDoNotBreakAfterList.Text = "Use \'do-not-beak-after\' list (for auto-br)";
this.checkBoxUseDoNotBreakAfterList.Text = "Use \'do-not-beak-after\' list";
this.checkBoxUseDoNotBreakAfterList.UseVisualStyleBackColor = true;
//
// groupBoxSpellCheck
@ -2892,7 +2918,7 @@
this.groupBoxToolsVisualSync.Controls.Add(this.labelVerifyButton);
this.groupBoxToolsVisualSync.Location = new System.Drawing.Point(6, 6);
this.groupBoxToolsVisualSync.Name = "groupBoxToolsVisualSync";
this.groupBoxToolsVisualSync.Size = new System.Drawing.Size(820, 116);
this.groupBoxToolsVisualSync.Size = new System.Drawing.Size(409, 116);
this.groupBoxToolsVisualSync.TabIndex = 2;
this.groupBoxToolsVisualSync.TabStop = false;
this.groupBoxToolsVisualSync.Text = "Visual sync";
@ -4332,6 +4358,16 @@
//
this.openFileDialogFFmpeg.FileName = "openFileDialog1";
//
// checkBoxToolsBreakEarlyLineEnding
//
this.checkBoxToolsBreakEarlyLineEnding.AutoSize = true;
this.checkBoxToolsBreakEarlyLineEnding.Location = new System.Drawing.Point(16, 95);
this.checkBoxToolsBreakEarlyLineEnding.Name = "checkBoxToolsBreakEarlyLineEnding";
this.checkBoxToolsBreakEarlyLineEnding.Size = new System.Drawing.Size(175, 17);
this.checkBoxToolsBreakEarlyLineEnding.TabIndex = 28;
this.checkBoxToolsBreakEarlyLineEnding.Text = "Break early for line ending (.!?)";
this.checkBoxToolsBreakEarlyLineEnding.UseVisualStyleBackColor = true;
//
// Settings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -4393,8 +4429,8 @@
this.groupBoxGoogleTranslate.PerformLayout();
this.groupBoxBing.ResumeLayout(false);
this.groupBoxBing.PerformLayout();
this.groupBoxToolsMisc.ResumeLayout(false);
this.groupBoxToolsMisc.PerformLayout();
this.groupBoxToolsAutoBr.ResumeLayout(false);
this.groupBoxToolsAutoBr.PerformLayout();
this.groupBoxSpellCheck.ResumeLayout(false);
this.groupBoxSpellCheck.PerformLayout();
this.groupBoxFixCommonErrors.ResumeLayout(false);
@ -4700,7 +4736,7 @@
private System.Windows.Forms.Button buttonVlcPathBrowse;
private System.Windows.Forms.TextBox textBoxVlcPath;
private System.Windows.Forms.Label labelVlcPath;
private System.Windows.Forms.GroupBox groupBoxToolsMisc;
private System.Windows.Forms.GroupBox groupBoxToolsAutoBr;
private System.Windows.Forms.CheckBox checkBoxUseDoNotBreakAfterList;
private System.Windows.Forms.Button buttonEditDoNotBreakAfterList;
private System.Windows.Forms.CheckBox checkBoxCheckForUpdates;
@ -4799,5 +4835,8 @@
private System.Windows.Forms.CheckBox checkBoxCpsIncludeWhiteSpace;
private System.Windows.Forms.Label labelBingTokenEndpoint;
private System.Windows.Forms.TextBox textBoxBingTokenEndpoint;
private System.Windows.Forms.CheckBox checkBoxToolsBreakEarlyComma;
private System.Windows.Forms.CheckBox checkBoxToolsBreakEarlyDash;
private System.Windows.Forms.CheckBox checkBoxToolsBreakEarlyLineEnding;
}
}

View File

@ -643,8 +643,11 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxTreatINQuoteAsING.Text = Configuration.Settings.Language.SpellCheck.TreatINQuoteAsING;
checkBoxUseAlwaysToFile.Text = Configuration.Settings.Language.SpellCheck.RememberUseAlwaysList;
groupBoxToolsMisc.Text = language.Miscellaneous;
groupBoxToolsAutoBr.Text = Configuration.Settings.Language.Main.Controls.AutoBreak;
checkBoxUseDoNotBreakAfterList.Text = language.UseDoNotBreakAfterList;
checkBoxToolsBreakEarlyComma.Text = language.BreakEarlyForComma;
checkBoxToolsBreakEarlyDash.Text = language.BreakEarlyForDashDialog;
checkBoxToolsBreakEarlyLineEnding.Text = language.BreakEarlyForLineEnding;
checkBoxCpsIncludeWhiteSpace.Text = language.CpsIncludesSpace;
buttonEditDoNotBreakAfterList.Text = Configuration.Settings.Language.VobSubOcr.Edit;
@ -824,6 +827,9 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxTreatINQuoteAsING.Checked = toolsSettings.SpellCheckEnglishAllowInQuoteAsIng;
checkBoxUseAlwaysToFile.Checked = toolsSettings.RememberUseAlwaysList;
checkBoxUseDoNotBreakAfterList.Checked = toolsSettings.UseNoLineBreakAfter;
checkBoxToolsBreakEarlyComma.Checked = toolsSettings.AutoBreakCommaBreakEarly;
checkBoxToolsBreakEarlyDash.Checked = toolsSettings.AutoBreakDashEarly;
checkBoxToolsBreakEarlyLineEnding.Checked = toolsSettings.AutoBreakLineEndingEarly;
checkBoxCpsIncludeWhiteSpace.Checked = !Configuration.Settings.General.CharactersPerSecondsIgnoreWhiteSpace;
textBoxBingClientSecret.Text = Configuration.Settings.Tools.MicrosoftTranslatorApiKey;
@ -1607,6 +1613,10 @@ namespace Nikse.SubtitleEdit.Forms
toolsSettings.SpellCheckEnglishAllowInQuoteAsIng = checkBoxTreatINQuoteAsING.Checked;
toolsSettings.RememberUseAlwaysList = checkBoxUseAlwaysToFile.Checked;
toolsSettings.UseNoLineBreakAfter = checkBoxUseDoNotBreakAfterList.Checked;
toolsSettings.AutoBreakCommaBreakEarly = checkBoxToolsBreakEarlyComma.Checked;
toolsSettings.AutoBreakLineEndingEarly = checkBoxToolsBreakEarlyLineEnding.Checked;
toolsSettings.AutoBreakDashEarly = checkBoxToolsBreakEarlyDash.Checked;
Configuration.Settings.General.CharactersPerSecondsIgnoreWhiteSpace = !checkBoxCpsIncludeWhiteSpace.Checked;
toolsSettings.OcrFixUseHardcodedRules = checkBoxFixCommonOcrErrorsUsingHardcodedRules.Checked;
toolsSettings.FixShortDisplayTimesAllowMoveStartTime = checkBoxFixShortDisplayTimesAllowMoveStartTime.Checked;

View File

@ -153,6 +153,7 @@ namespace Test.Logic
{
var old = Configuration.Settings.General.MaxNumberOfLines;
Configuration.Settings.General.MaxNumberOfLines = 3;
Configuration.Settings.Tools.AutoBreakLineEndingEarly = true;
const string s1 = "Sorry. Sorry, I was miles away. Got to get everything ready for today.";
string s2 = Utilities.AutoBreakLine(s1);
Configuration.Settings.General.MaxNumberOfLines = old;
@ -163,6 +164,7 @@ namespace Test.Logic
public void AutoBreakPreferPeriod2()
{
const string s1 = "That's alright. I get it all the time.";
Configuration.Settings.Tools.AutoBreakLineEndingEarly = true;
string s2 = Utilities.AutoBreakLine(s1);
Assert.AreEqual("That's alright." + Environment.NewLine + "I get it all the time.", s2);
}
@ -171,6 +173,7 @@ namespace Test.Logic
public void AutoBreakPreferPeriod3()
{
const string s1 = "That's alright... I get it all the time.";
Configuration.Settings.Tools.AutoBreakLineEndingEarly = true;
string s2 = Utilities.AutoBreakLine(s1);
Assert.AreEqual("That's alright..." + Environment.NewLine + "I get it all the time.", s2);
}
@ -179,6 +182,7 @@ namespace Test.Logic
public void AutoBreakPreferExclamation()
{
const string s1 = "That's alright!!! I get it all the time.";
Configuration.Settings.Tools.AutoBreakLineEndingEarly = true;
string s2 = Utilities.AutoBreakLine(s1);
Assert.AreEqual("That's alright!!!" + Environment.NewLine + "I get it all the time.", s2);
}
@ -188,6 +192,7 @@ namespace Test.Logic
{
var old = Configuration.Settings.General.MaxNumberOfLines;
Configuration.Settings.General.MaxNumberOfLines = 3;
Configuration.Settings.Tools.AutoBreakLineEndingEarly = true;
const string s1 = "Sorry. Sorry, I was miles away. Got to get everything ready for <i>today</i>.";
string s2 = Utilities.AutoBreakLine(s1);
Configuration.Settings.General.MaxNumberOfLines = old;
@ -197,6 +202,7 @@ namespace Test.Logic
[TestMethod]
public void AutoBreakPreferComma()
{
Configuration.Settings.Tools.AutoBreakCommaBreakEarly = true;
const string s1 = "Ha Ha Ha Ha Ha Ha Ha Ha Ha, Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha.";
string s2 = Utilities.AutoBreakLine(s1);
Assert.AreEqual("Ha Ha Ha Ha Ha Ha Ha Ha Ha," + Environment.NewLine + "Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha Ha.", s2);