@@ -53,6 +53,7 @@ internal Speller(TextEditor textEditor)
5353
5454 _defaultCulture = InputLanguageManager . Current != null ? InputLanguageManager . Current . CurrentInputLanguage :
5555 Thread . CurrentThread . CurrentCulture ;
56+ _defaultComparer = StringComparer . Create ( _defaultCulture , true ) ;
5657 }
5758
5859 #endregion Constructors
@@ -224,17 +225,15 @@ internal IList GetSuggestionsForError(SpellingError error)
224225 // implement this as a process-wide list.
225226 internal void IgnoreAll ( string word )
226227 {
227- if ( _ignoredWordsList == null )
228- {
229- _ignoredWordsList = new ArrayList ( 1 ) ;
230- }
228+ if ( _ignoredWordsList is null )
229+ _ignoredWordsList = new List < string > ( 1 ) ;
231230
232- int index = _ignoredWordsList . BinarySearch ( word , new CaseInsensitiveComparer ( _defaultCulture ) ) ;
231+ int index = _ignoredWordsList . BinarySearch ( word , _defaultComparer ) ;
233232
233+ // If we didn't find the word, we're gonna add it to ignore list
234234 if ( index < 0 )
235235 {
236236 // This is a new word to ignore.
237-
238237 // Add it the list so we don't flag it later.
239238 _ignoredWordsList . Insert ( ~ index , word ) ;
240239
@@ -1438,17 +1437,7 @@ private bool ExpandToWordBreakCallback(SpellerInteropBase.ISpellerSegment textSe
14381437 }
14391438
14401439 // Returns true if a user has tagged the specified word with "Ignore All".
1441- private bool IsIgnoredWord ( char [ ] word )
1442- {
1443- bool isIgnoredWord = false ;
1444-
1445- if ( _ignoredWordsList != null )
1446- {
1447- isIgnoredWord = _ignoredWordsList . BinarySearch ( new string ( word ) , new CaseInsensitiveComparer ( _defaultCulture ) ) >= 0 ;
1448- }
1449-
1450- return isIgnoredWord ;
1451- }
1440+ private bool IsIgnoredWord ( char [ ] word ) => _ignoredWordsList ? . BinarySearch ( new string ( word ) , _defaultComparer ) >= 0 ;
14521441
14531442 // Returns true if we have an engine capable of proofing the specified
14541443 // language.
@@ -2052,11 +2041,12 @@ internal object Lexicon
20522041 private bool _pendingCaretMovedCallback ;
20532042
20542043 // List of words tagged by the user as non-errors.
2055- private ArrayList _ignoredWordsList ;
2044+ private List < string > _ignoredWordsList ;
20562045
20572046 // The CultureInfo associated with this speller.
20582047 // Used for ignored words comparison, and plain text controls (TextBox).
20592048 private readonly CultureInfo _defaultCulture ;
2049+ private readonly IComparer < string > _defaultComparer ;
20602050
20612051 // Set true if the nl6 library is unavailable.
20622052 private bool _failedToInit ;
0 commit comments