Formatting (whitespace only)

This commit is contained in:
Waldi Ravens 2020-04-20 06:57:32 +02:00
parent c28b2a08bd
commit da331e26dd
11 changed files with 44 additions and 48 deletions

View File

@ -162,7 +162,7 @@ namespace Nikse.SubtitleEdit.Core
checkString = checkString.Trim();
// Remove string elevation
if (checkString.EndsWith("\n_", StringComparison.Ordinal) || checkString.EndsWith("\n.", StringComparison.Ordinal)
if (checkString.EndsWith("\n_", StringComparison.Ordinal) || checkString.EndsWith("\n.", StringComparison.Ordinal)
|| checkString.EndsWith("\n _", StringComparison.Ordinal) || checkString.EndsWith("\n .", StringComparison.Ordinal)
|| checkString.EndsWith("\n _", StringComparison.Ordinal) || checkString.EndsWith("\n .", StringComparison.Ordinal) /* Alt+255 */)
{
@ -226,7 +226,7 @@ namespace Nikse.SubtitleEdit.Core
return firstWord;
}
public static string GetLastWord(string input)
{
// Return if empty string
@ -283,7 +283,7 @@ namespace Nikse.SubtitleEdit.Core
{
return originalText;
}
// Return if only suffix/prefix
if (IsOnlySuffix(text, profile) || IsOnlyPrefix(text, profile))
{
@ -299,7 +299,7 @@ namespace Nikse.SubtitleEdit.Core
// Make new last word
string gapAddEnd = (profile.GapSuffixAddSpace ? " " : "") + profile.GapSuffix;
if (gapAddEnd.Length == 0 || !newLastWord.EndsWith(gapAddEnd)) {
if (gapAddEnd.Length == 0 || !newLastWord.EndsWith(gapAddEnd)) {
newLastWord = newLastWord.TrimEnd(',') + ((lastWord.EndsWith(",") || addComma) && !profile.GapSuffixReplaceComma ? "," : "") + gapAddEnd;
}
}
@ -308,7 +308,7 @@ namespace Nikse.SubtitleEdit.Core
// Make new last word
string addEnd = (profile.SuffixAddSpace ? " " : "") + profile.Suffix;
if (addEnd.Length == 0 || !newLastWord.EndsWith(addEnd)) {
if (addEnd.Length == 0 || !newLastWord.EndsWith(addEnd)) {
newLastWord = newLastWord.TrimEnd(',') + ((lastWord.EndsWith(",") || addComma) && !profile.SuffixReplaceComma ? "," : "") + addEnd;
}
}
@ -319,8 +319,8 @@ namespace Nikse.SubtitleEdit.Core
if (wordIndex >= 0 && wordIndex < originalText.Length - 3)
{
int currentIndex = wordIndex + lastWord.TrimEnd(',').Length;
if (((currentIndex < originalText.Length && originalText[currentIndex] == '<')
|| (currentIndex + 1 < originalText.Length && originalText[currentIndex + 1] == ',' && originalText[currentIndex] == '<'))
if (((currentIndex < originalText.Length && originalText[currentIndex] == '<')
|| (currentIndex + 1 < originalText.Length && originalText[currentIndex + 1] == ',' && originalText[currentIndex] == '<'))
&& !IsFullLineTag(originalText, currentIndex))
{
if (currentIndex < originalText.Length && originalText[currentIndex] == ',')
@ -404,7 +404,7 @@ namespace Nikse.SubtitleEdit.Core
removeDashesDuringSanitization = false;
}
}
string text = removeDashesDuringSanitization ? textWithoutDash : textWithDash;
// Return if empty string
@ -626,7 +626,7 @@ namespace Nikse.SubtitleEdit.Core
var prefix = firstWord.Replace(newFirstWord, "");
result = ReplaceFirstOccurrence(originalText, prefix, "");
}
// Return original if empty string
if (string.IsNullOrEmpty(result))
{
@ -794,7 +794,7 @@ namespace Nikse.SubtitleEdit.Core
return true;
}
public static bool IsFullLineTag(string input, int position)
{
input = ExtractParagraphOnly(input);
@ -1250,4 +1250,4 @@ namespace Nikse.SubtitleEdit.Core
public bool GapPrefixAddSpace { get; set; }
}
}
}
}

View File

@ -24,7 +24,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
{
this.SetContinuationProfile(Configuration.Settings.General.ContinuationStyle);
}
int minGapMs = ContinuationUtilities.GetMinimumGapMs();
bool inSentence = false;
@ -57,7 +57,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
}
}
// ...and italic lyrics
// ...and italic lyrics
if (Configuration.Settings.General.FixContinuationStyleUncheckInsertsItalic)
{
if (ContinuationUtilities.IsItalic(oldText) && !ContinuationUtilities.IsNewSentence(text, true) && inItalicSentence == false)
@ -85,10 +85,10 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
var oldTextNextWithoutPrefix = ContinuationUtilities.RemovePrefix(oldTextNext, _continuationProfile, true, gap);
var textNextWithoutPrefix = ContinuationUtilities.SanitizeString(oldTextNextWithoutPrefix, true);
// Get last word of this paragraph
// Get last word of this paragraph
string lastWord = ContinuationUtilities.GetLastWord(text);
// If ends with dots (possible interruptions), or nothing, check if next sentence is new sentence, otherwise don't check by default
if (text.EndsWith("..") || text.EndsWith("…") || ContinuationUtilities.EndsWithNothing(text, _continuationProfile))
{
@ -110,7 +110,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
}
}
}
if (shouldProcess)
{
// First paragraph...
@ -125,7 +125,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
// Make new last word
var newText = ContinuationUtilities.AddSuffixIfNeeded(oldTextWithoutSuffix, _continuationProfile, gap, addComma);
// Commit if changed
if (oldText != newText && callbacks.AllowFix(p, fixAction))
{
@ -211,7 +211,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
{
return ContinuationUtilities.HasSuffix(input, this._continuationProfile);
}
private bool StartsWithName(string input, string language)
{
if (this._names == null)

View File

@ -2236,7 +2236,7 @@
public string GoToStartCurrent { get; set; }
public string ToggleStartEndCurrent { get; set; }
public string PlayCurrent { get; set; }
public string WaveformGoToPrevSubtitle { get; set; }
public string WaveformGoToNextSubtitle { get; set; }
public string WaveformSelectNextSubtitle { get; set; }
@ -2327,7 +2327,7 @@
public string UncheckInsertsAllCaps { get; set; }
public string UncheckInsertsItalic { get; set; }
public string UncheckInsertsLowercase { get; set; }
public string HideContinuationCandidatesWithoutName { get; set; }
public string HideContinuationCandidatesWithoutName { get; set; }
public string IgnoreLyrics { get; set; }
}

View File

@ -19,7 +19,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
var sb = new StringBuilder();
foreach (var p in subtitle.Paragraphs)
{
//0:13 0:14 I'm from Londrina, Paraná, Brasil.
//0:13<HT>0:14<HT>I'm from Londrina, Paraná, Brasil.
sb.AppendLine($"{EncodeTimeCode(p.StartTime)}\t{EncodeTimeCode(p.EndTime)}\t{HtmlUtil.RemoveHtmlTags(p.Text, true).Replace(Environment.NewLine, " ")}");
}
return sb.ToString();

View File

@ -15,13 +15,13 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
public override string ToText(Subtitle subtitle, string title)
{
//001 10:00:00.22 10:00:04.22 00:00:04.00 #F CC00000D0 #C
//001<HT>10:00:00.22<HT>10:00:04.22<HT>00:00:04.00<HT>#F CC00000D0<HT>#C
//Studio presents
//002 10:00:13.02 10:00:15.22 00:00:02.20 #F CC00000D0 #C
//002 10:00:13.02 10:00:15.22 00:00:02.20<HT>#F CC00000D0<HT>#C
//What does my stuff
//mean to me ?
const string writeFormat = "{0:000} {1} {2} {3} #F CC00000D0 #C{4}{5}";
const string writeFormat = "{0:000} {1} {2} {3}\t#F CC00000D0\t#C{4}{5}";
var sb = new StringBuilder();
for (var index = 0; index < subtitle.Paragraphs.Count; index++)
{

View File

@ -295,7 +295,7 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxContinuationStyle.SelectedIndex = 0;
toolTipContinuationPreview.RemoveAll();
toolTipContinuationPreview.SetToolTip(comboBoxContinuationStyle, ContinuationUtilities.GetContinuationStylePreview(RulesProfiles[idx].ContinuationStyle));
comboBoxContinuationStyle.SelectedIndex = ContinuationUtilities.GetIndexFromContinuationStyle(RulesProfiles[idx].ContinuationStyle);
comboBoxContinuationStyle.SelectedIndex = ContinuationUtilities.GetIndexFromContinuationStyle(RulesProfiles[idx].ContinuationStyle);
_editOn = oldEditOn;
}

View File

@ -248,7 +248,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Binary
string s = Path.GetFileNameWithoutExtension(dir);
list.Add(s);
}
return list.OrderBy(p=>p).ToList();
return list.OrderBy(p => p).ToList();
}
}

View File

@ -33,7 +33,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr.Tesseract
var jobs = (List<TesseractThreadRunner.ImageJob>)j;
var job = jobs.First();
var results = _tesseractRunner.Run(job.LanguageCode, job.PsmMode, job.EngineMode, jobs.Select(p=>p.FileName).ToList(), job.Run302);
var results = _tesseractRunner.Run(job.LanguageCode, job.PsmMode, job.EngineMode, jobs.Select(p => p.FileName).ToList(), job.Run302);
lock (QueueLock)
{

View File

@ -445,7 +445,6 @@ namespace Nikse.SubtitleEdit.Logic
}
}
private static Font _defaultSystemFont;
private static Font DefaultSystemFont
{
@ -593,9 +592,6 @@ namespace Nikse.SubtitleEdit.Logic
c.Font = GetDefaultFont();
}
foreach (Control inner in c.Controls)
{
FixFontsInner(inner, iterations - 1);

View File

@ -89,7 +89,7 @@ namespace Test.Logic
string line1Expected = "...this is a test." + Environment.NewLine + "- Another test...";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void SanitizeString8()
{
@ -361,7 +361,7 @@ namespace Test.Logic
string line1Expected = "<i>This is a test...</i>";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void AddSuffixIfNeeded9()
{
@ -481,7 +481,7 @@ namespace Test.Logic
string line1Expected = "...";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void AddSuffixIfNeeded15()
{
@ -491,7 +491,7 @@ namespace Test.Logic
string line1Expected = "妈...";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void AddSuffixIfNeeded16()
{
@ -601,7 +601,7 @@ namespace Test.Logic
string line1Expected = "- <b>this</b> is a test." + Environment.NewLine + "-A what do you say?";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void AddPrefixIfNeeded8()
{
@ -641,7 +641,7 @@ namespace Test.Logic
string line1Expected = "- ...<i>this</i> is a test." + Environment.NewLine + "- Okay.";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void AddPrefixIfNeeded10()
{
@ -741,7 +741,7 @@ namespace Test.Logic
string line1Expected = "<i>This is a test</i>" + Environment.NewLine + " " + Environment.NewLine + "_";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void RemoveSuffix2()
{
@ -861,7 +861,7 @@ namespace Test.Logic
string line1Expected = "<i><b>this</b> is a test.</i>" + Environment.NewLine + " " + Environment.NewLine + "_";
Assert.AreEqual(line1Expected, line1Actual);
}
[TestMethod]
public void RemovePrefix4()
{
@ -945,7 +945,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.IsNewSentence(line1);
Assert.IsTrue(line1Actual);
}
[TestMethod]
public void IsNewSentence4()
{
@ -1009,7 +1009,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
Assert.IsTrue(line1Actual);
}
[TestMethod]
public void IsEndOfSentence3()
{
@ -1025,7 +1025,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
Assert.IsTrue(line1Actual);
}
[TestMethod]
public void IsEndOfSentence5()
{
@ -1049,7 +1049,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.IsEndOfSentence(line1);
Assert.IsFalse(line1Actual);
}
[TestMethod]
public void IsEndOfSentence8()
{
@ -1114,7 +1114,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.EndsWithNothing(line1, profile);
Assert.IsTrue(line1Actual);
}
[TestMethod]
public void EndsWithNothing2()
{
@ -1627,7 +1627,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.HasSuffix(line1, profile);
Assert.IsFalse(line1Actual);
}
[TestMethod]
public void IsOnlySuffix1()
{
@ -1645,7 +1645,7 @@ namespace Test.Logic
bool line1Actual = ContinuationUtilities.IsOnlySuffix(line1, profile);
Assert.IsTrue(line1Actual);
}
[TestMethod]
public void IsOnlySuffix3()
{
@ -1771,7 +1771,7 @@ namespace Test.Logic
Assert.AreEqual(line1Expected, line1Actual);
Assert.AreEqual(line2Expected, line2Actual);
}
[TestMethod]
public void MergeHelper2()
{

View File

@ -70,7 +70,7 @@ namespace UpdateLanguageFiles
{
File.WriteAllText(args[1], languageDeserializerContent, Encoding.UTF8);
}
catch
catch
{
System.Threading.Thread.Sleep(100);
File.WriteAllText(args[1], languageDeserializerContent, Encoding.UTF8);