Ignore (some) urls in spell check

This commit is contained in:
Nikolaj Olsson 2020-05-21 15:48:24 +02:00
parent 471436073d
commit 0c0441b336

View File

@ -655,6 +655,7 @@ namespace Nikse.SubtitleEdit.Forms
_currentWord = _currentWord.TrimEnd('\'');
correct = true;
}
if (!correct)
{
string removeUnicode = _currentWord.Replace("\u200b", string.Empty); // zero width space
@ -663,6 +664,18 @@ namespace Nikse.SubtitleEdit.Forms
correct = DoSpell(removeUnicode);
}
if (!correct && _wordsIndex > 1 && _words.Count > _wordsIndex &&
_words[_wordsIndex - 1].Text.ToLowerInvariant() == "www" &&
(_words[_wordsIndex + 1].Text.ToLowerInvariant() == "com" ||
_words[_wordsIndex + 1].Text.ToLowerInvariant() == "org" ||
_words[_wordsIndex + 1].Text.ToLowerInvariant() == "net") &&
_currentParagraph.Text.IndexOf(_words[_wordsIndex - 1].Text + "." +
_currentWord + "." +
_words[_wordsIndex + 1].Text, StringComparison.OrdinalIgnoreCase) >= 0)
{
correct = true; // do not spell check urls
}
if (!correct && (_languageName.StartsWith("ar_", StringComparison.Ordinal) || _languageName == "ar"))
{
var trimmed = _currentWord.Trim('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', ',', '،');