diff --git a/libse/SpellCheck/SpellCheckWordLists.cs b/libse/SpellCheck/SpellCheckWordLists.cs index 488fa58c1..09f18d3b3 100644 --- a/libse/SpellCheck/SpellCheckWordLists.cs +++ b/libse/SpellCheck/SpellCheckWordLists.cs @@ -179,6 +179,30 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck return s; } + public string ReplaceAssTagsWithBlanks(string s) + { + int start = s.IndexOf("{\\", StringComparison.Ordinal); + int end = s.IndexOf('}'); + if (start < 0 || end < 0 || end < start) + { + return s; + } + + while (start >= 0) + { + end = s.IndexOf('}', start + 1); + if (end < start) + break; + int l = end - start + 1; + s = s.Remove(start, l).Insert(start, string.Empty.PadLeft(l)); + end++; + if (end >= s.Length) + break; + start = s.IndexOf("{\\", end, StringComparison.Ordinal); + } + return s; + } + public bool IsWordInUserPhrases(int index, List words) { string current = words[index].Text; diff --git a/src/Forms/SpellCheck.cs b/src/Forms/SpellCheck.cs index e92cfd379..17f5a68ce 100644 --- a/src/Forms/SpellCheck.cs +++ b/src/Forms/SpellCheck.cs @@ -785,6 +785,7 @@ namespace Nikse.SubtitleEdit.Forms private void SetWords(string s) { s = _spellCheckWordLists.ReplaceHtmlTagsWithBlanks(s); + s = _spellCheckWordLists.ReplaceAssTagsWithBlanks(s); s = _spellCheckWordLists.ReplaceKnownWordsOrNamesWithBlanks(s); _words = SpellCheckWordLists.Split(s); }