From cff84f15a68c2c1aa947c0ae180b63dcf5a880f7 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Sat, 2 Nov 2024 20:23:57 +0000 Subject: [PATCH] Make `ShowStatus` method private Updated `ShowStatus` method to be private to encapsulate its use within the class. Corrected comments for grammatical consistency and changed deSelectedFixes to a HashSet for better performance. Simplified the conditional check with `HasSentenceEnding` to improve readability. Signed-off-by: Ivandro Jao --- src/ui/Forms/FixCommonErrors.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/Forms/FixCommonErrors.cs b/src/ui/Forms/FixCommonErrors.cs index f3d5567fd5..760fc171d7 100644 --- a/src/ui/Forms/FixCommonErrors.cs +++ b/src/ui/Forms/FixCommonErrors.cs @@ -663,7 +663,7 @@ public bool AllowFix(Paragraph p, string action) return _allowedFixes.Contains(p.Number.ToString(CultureInfo.InvariantCulture) + "|" + action); } - public void ShowStatus(string message) + private void ShowStatus(string message) { message = message.Replace(Environment.NewLine, " "); if (message.Length > 103) @@ -712,10 +712,10 @@ private void MakeSureNameListIsLoaded() if (_nameList == null) { string languageTwoLetterCode = LanguageAutoDetect.AutoDetectGoogleLanguage(Subtitle); - // Will contains both one word names and multi names + // Will contains both one-word names and multi names var namesList = new NameList(Configuration.DictionariesDirectory, languageTwoLetterCode, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl); _nameList = namesList.GetNames(); - // Multi word names. + // Multi-word names. foreach (var name in namesList.GetMultiNames()) { _nameList.Add(name); @@ -1474,7 +1474,7 @@ private void RefreshFixes() listViewFixes.BeginUpdate(); // save de-selected fixes - var deSelectedFixes = new List(); + var deSelectedFixes = new HashSet(); foreach (ListViewItem item in listViewFixes.Items) { if (!item.Checked) @@ -1751,7 +1751,7 @@ private void SplitSelectedParagraph(double? splitSeconds) string oldText = currentParagraph.Text; var lines = currentParagraph.Text.SplitToLines(); - if (lines.Count == 2 && (lines[0].EndsWith('.') || lines[0].EndsWith('!') || lines[0].EndsWith('?'))) + if (lines.Count == 2 && lines[0].HasSentenceEnding()) { currentParagraph.Text = Utilities.AutoBreakLine(lines[0], Language); newParagraph.Text = Utilities.AutoBreakLine(lines[1], Language);