Fix crash in "Start with uppercase after colon" - thx Rouzax :)

Related to #8029
This commit is contained in:
Nikolaj Olsson 2024-03-15 16:43:14 +01:00
parent 5ffb0f4b6b
commit d1e66d2b53
2 changed files with 12 additions and 1 deletions

View File

@ -2126,6 +2126,17 @@ namespace Test.FixCommonErrors
} }
} }
[TestMethod]
public void StartWithUppercaseAfterColon5()
{
using (var target = GetFixCommonErrorsLib())
{
InitializeFixCommonErrorsLine(target, "TRANSLATION FROM FRENCH:");
new FixStartWithUppercaseLetterAfterColon().Fix(_subtitle, new EmptyFixCallback());
Assert.AreEqual("TRANSLATION FROM FRENCH:", _subtitle.Paragraphs[0].Text);
}
}
#endregion Start with upppercase after colon #endregion Start with upppercase after colon
#region Fix Music Notation #region Fix Music Notation

View File

@ -42,7 +42,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
// skip white space before formatting // skip white space before formatting
while (k < len && text[k] == ' ') k++; while (k < len && text[k] == ' ') k++;
// skip formatting e.g: <i>, <b>,<font..>... // skip formatting e.g: <i>, <b>,<font..>...
while (k < len && text[k] == '<' || text[k] == '{') while (k < len && (text[k] == '<' || text[k] == '{'))
{ {
var closingPair = GetClosingPair(text[k]); var closingPair = GetClosingPair(text[k]);
var closeIdx = text.IndexOf(closingPair, k + 1); var closeIdx = text.IndexOf(closingPair, k + 1);