mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Fix for "Spell check" auto-fix name - thx Chamallow :)
This commit is contained in:
parent
c37146aebc
commit
c79317c527
@ -290,7 +290,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
|
||||
public bool HasName(string word)
|
||||
{
|
||||
return _namesEtcList.Contains(word) || (word.StartsWith('\'') || word.EndsWith('\'')) && _namesEtcList.Contains(word.Trim('\''));
|
||||
return _namesEtcList.Contains(word) || ((word.StartsWith('\'') || word.EndsWith('\'')) && _namesEtcList.Contains(word.Trim('\'')));
|
||||
}
|
||||
|
||||
public bool HasNameExtended(string word, string text)
|
||||
|
@ -631,18 +631,33 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
DoAction(SpellCheckAction.ChangeAll);
|
||||
return;
|
||||
}
|
||||
if (AutoFixNames && _currentWord.Length > 3 && suggestions.Contains(_currentWord.ToUpper()))
|
||||
if (AutoFixNames && _currentWord.Length > 1)
|
||||
{
|
||||
if (_currentWord.Length > 3 && suggestions.Contains(_currentWord.ToUpper()))
|
||||
{ // does not work well with two letter words like "da" and "de" which get auto-corrected to "DA" and "DE"
|
||||
ChangeWord = _currentWord.ToUpper();
|
||||
DoAction(SpellCheckAction.ChangeAll);
|
||||
return;
|
||||
}
|
||||
if (AutoFixNames && _currentWord.Length > 1 && _spellCheckWordLists.HasName(char.ToUpper(_currentWord[0]) + _currentWord.Substring(1)))
|
||||
if (_spellCheckWordLists.HasName(char.ToUpper(_currentWord[0]) + _currentWord.Substring(1)))
|
||||
{
|
||||
ChangeWord = char.ToUpper(_currentWord[0]) + _currentWord.Substring(1);
|
||||
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)))
|
||||
{
|
||||
ChangeWord = char.ToUpper(_currentWord[0]) + _currentWord.Substring(1, 1) + char.ToUpper(_currentWord[2]) + _currentWord.Remove(0, 3);
|
||||
DoAction(SpellCheckAction.ChangeAll);
|
||||
return;
|
||||
}
|
||||
if (_spellCheckWordLists.HasName(_currentWord.ToUpperInvariant()))
|
||||
{
|
||||
ChangeWord = _currentWord.ToUpperInvariant();
|
||||
DoAction(SpellCheckAction.ChangeAll);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_prefix != null && _prefix == "''" && _currentWord.EndsWith("''"))
|
||||
{
|
||||
_prefix = string.Empty;
|
||||
|
Loading…
Reference in New Issue
Block a user