Merge pull request #1096 from ivandrofly/patch-1a

BUGFIXED + Optimization
This commit is contained in:
Nikolaj Olsson 2015-08-24 21:13:41 +02:00
commit 9311167da4

View File

@ -97,7 +97,7 @@ namespace Nikse.SubtitleEdit.Logic.Forms
foreach (string line in lines)
{
int indexOfColon = line.IndexOf(':');
if (indexOfColon > 0 && IsNotInsideBrackets(text, indexOfColon))
if (indexOfColon > 0 && IsNotInsideBrackets(line, indexOfColon))
{
var pre = line.Substring(0, indexOfColon);
var noTagPre = HtmlUtil.RemoveHtmlTags(pre, true);
@ -338,9 +338,8 @@ namespace Nikse.SubtitleEdit.Logic.Forms
private bool IsNotInsideBrackets(string text, int colonIdx)
{
// <i>♪ (THE CAPITOLS: "COOL JERK") ♪</i>
var bIdx = text.IndexOfAny(new[] { '(', '[' });
if (bIdx >= 0 && bIdx < colonIdx)
var bIdx = text.IndexOfAny(new[] { '(', '[' }, 0, colonIdx);
if (bIdx >= 0)
{
char closeType = text[bIdx] == '(' ? ')' : ']';
var nIdx = text.IndexOf(closeType, bIdx + 1);