mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 14:32:35 +01:00
Make spell check auto-fix-names less aggressive - thx rhcauthen :)
This commit is contained in:
parent
f2f8ff5e9c
commit
e881ae8721
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user