mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-01-31 21:11:39 +01:00
Minor refact
This commit is contained in:
parent
790eb02b82
commit
497633c1be
@ -431,7 +431,7 @@ namespace Nikse.SubtitleEdit.Core
|
|||||||
foreach (Paragraph paragraph in subtitle.Paragraphs)
|
foreach (Paragraph paragraph in subtitle.Paragraphs)
|
||||||
{
|
{
|
||||||
string text = paragraph.Text.Trim();
|
string text = paragraph.Text.Trim();
|
||||||
if (text.StartsWith(prefix))
|
if (text.StartsWith(prefix, StringComparison.Ordinal))
|
||||||
paragraph.Text = text.Remove(0, prefix.Length);
|
paragraph.Text = text.Remove(0, prefix.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3754,14 +3754,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
// Set default RTL or LTR
|
// Set default RTL or LTR
|
||||||
if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
|
if (Configuration.Settings.General.AllowEditOfOriginalSubtitle && _subtitleAlternate != null && _subtitleAlternate.Paragraphs.Count > 0)
|
||||||
{
|
{
|
||||||
if (Configuration.Settings.General.RightToLeftMode)
|
textBoxListViewTextAlternate.RightToLeft = Configuration.Settings.General.RightToLeftMode ? RightToLeft.Yes : RightToLeft.No;
|
||||||
{
|
|
||||||
textBoxListViewTextAlternate.RightToLeft = RightToLeft.Yes;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textBoxListViewTextAlternate.RightToLeft = RightToLeft.No;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (Configuration.Settings.General.RightToLeftMode)
|
if (Configuration.Settings.General.RightToLeftMode)
|
||||||
{
|
{
|
||||||
@ -12390,7 +12383,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
if (line.TrimStart().StartsWith('-') || line.TrimStart().StartsWith("<i>-", StringComparison.Ordinal) || line.TrimStart().StartsWith("<i> -", StringComparison.Ordinal))
|
if (line.TrimStart().StartsWith('-') || line.TrimStart().StartsWith("<i>-", StringComparison.Ordinal) || line.TrimStart().StartsWith("<i> -", StringComparison.Ordinal))
|
||||||
sb.AppendLine(line);
|
sb.AppendLine(line);
|
||||||
else if (line.TrimStart().StartsWith("<i>") && line.Trim().Length > 3)
|
else if (line.TrimStart().StartsWith("<i>", StringComparison.Ordinal) && line.Trim().Length > 3)
|
||||||
sb.AppendLine("<i>- " + line.Substring(3).TrimStart());
|
sb.AppendLine("<i>- " + line.Substring(3).TrimStart());
|
||||||
else
|
else
|
||||||
sb.AppendLine("- " + line);
|
sb.AppendLine("- " + line);
|
||||||
|
@ -158,7 +158,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
int idx = word.Index - i;
|
int idx = word.Index - i;
|
||||||
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text))
|
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
richTextBoxParagraph.SelectionStart = idx;
|
richTextBoxParagraph.SelectionStart = idx;
|
||||||
richTextBoxParagraph.SelectionLength = word.Text.Length;
|
richTextBoxParagraph.SelectionLength = word.Text.Length;
|
||||||
@ -166,7 +166,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
idx = word.Index + i;
|
idx = word.Index + i;
|
||||||
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text))
|
if (idx >= 0 && idx < richTextBoxParagraph.Text.Length && richTextBoxParagraph.Text.Substring(idx).StartsWith(word.Text, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
richTextBoxParagraph.SelectionStart = idx;
|
richTextBoxParagraph.SelectionStart = idx;
|
||||||
richTextBoxParagraph.SelectionLength = word.Text.Length;
|
richTextBoxParagraph.SelectionLength = word.Text.Length;
|
||||||
@ -593,7 +593,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
var suggestions = new List<string>();
|
var suggestions = new List<string>();
|
||||||
|
|
||||||
if ((_currentWord == "Lt's" || _currentWord == "Lt'S") && _languageName.StartsWith("en_"))
|
if ((_currentWord == "Lt's" || _currentWord == "Lt'S") && _languageName.StartsWith("en_", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
suggestions.Add("It's");
|
suggestions.Add("It's");
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < suggestions.Count; i++)
|
for (int i = 0; i < suggestions.Count; i++)
|
||||||
{
|
{
|
||||||
if (suggestions[i].StartsWith("L'") || suggestions[i].StartsWith("L’"))
|
if (suggestions[i].StartsWith("L'", StringComparison.Ordinal) || suggestions[i].StartsWith("L’", StringComparison.Ordinal))
|
||||||
suggestions[i] = @"l" + suggestions[i].Substring(1);
|
suggestions[i] = @"l" + suggestions[i].Substring(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -658,7 +658,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_prefix != null && _prefix == "''" && _currentWord.EndsWith("''"))
|
if (_prefix != null && _prefix == "''" && _currentWord.EndsWith("''", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
_prefix = string.Empty;
|
_prefix = string.Empty;
|
||||||
_currentSpellCheckWord.Index += 2;
|
_currentSpellCheckWord.Index += 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user