diff --git a/libse/SpellCheck/SpellCheckWordLists.cs b/libse/SpellCheck/SpellCheckWordLists.cs index 127ba407b..2594bc4c3 100644 --- a/libse/SpellCheck/SpellCheckWordLists.cs +++ b/libse/SpellCheck/SpellCheckWordLists.cs @@ -483,7 +483,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck public bool HasName(string word) { - return _names.Contains(word) || ((word.StartsWith('\'') || word.EndsWith('\'')) && _names.Contains(word.Trim('\''))); + return _names.Contains(word) || (word.StartsWith('\'') || word.EndsWith('\'')) && _names.Contains(word.Trim('\'')); } public bool HasNameExtended(string word, string text) diff --git a/src/Forms/SpellCheck.cs b/src/Forms/SpellCheck.cs index 949839d0f..aa82ec536 100644 --- a/src/Forms/SpellCheck.cs +++ b/src/Forms/SpellCheck.cs @@ -794,15 +794,9 @@ namespace Nikse.SubtitleEdit.Forms suggestions.Insert(0, "I"); } - if (AutoFixNames && _currentWord.Length > 1 && suggestions.Contains(char.ToUpper(_currentWord[0]) + _currentWord.Substring(1))) + if (AutoFixNames && _currentWord.Length > 3) { - ChangeWord = char.ToUpper(_currentWord[0]) + _currentWord.Substring(1); - DoAction(SpellCheckAction.ChangeAll); - return; - } - if (AutoFixNames && _currentWord.Length > 1) - { - if (_currentWord.Length > 3 && suggestions.Contains(_currentWord.ToUpperInvariant())) + if (suggestions.Contains(_currentWord.ToUpperInvariant())) { // does not work well with two letter words like "da" and "de" which get auto-corrected to "DA" and "DE" ChangeWord = _currentWord.ToUpperInvariant(); DoAction(SpellCheckAction.ChangeAll); @@ -814,7 +808,7 @@ namespace Nikse.SubtitleEdit.Forms DoAction(SpellCheckAction.ChangeAll); return; } - if (_currentWord.Length > 3 && _currentWord.StartsWith("mc", StringComparison.InvariantCultureIgnoreCase) && _spellCheckWordLists.HasName(char.ToUpper(_currentWord[0]) + _currentWord.Substring(1, 1) + char.ToUpper(_currentWord[2]) + _currentWord.Remove(0, 3))) + if (_currentWord.StartsWith("mc", StringComparison.InvariantCultureIgnoreCase) && _spellCheckWordLists.HasName(char.ToUpper(_currentWord[0]) + _currentWord.Substring(1, 1) + char.ToUpper(_currentWord[2]) + _currentWord.Remove(0, 3))) { ChangeWord = char.ToUpper(_currentWord[0]) + _currentWord.Substring(1, 1) + char.ToUpper(_currentWord[2]) + _currentWord.Remove(0, 3); DoAction(SpellCheckAction.ChangeAll); @@ -827,6 +821,7 @@ namespace Nikse.SubtitleEdit.Forms return; } } + if (_prefix != null && _prefix == "''" && _currentWord.EndsWith("''", StringComparison.Ordinal)) { _prefix = string.Empty;