Support spell checking being “automatic by language”

This must be set in the spelling panel and changing language via the spelling panel does not update the buffer (recheck the text with the new spelling language), so toggle automatic spelling after using the spelling panel to change language.

Closes #1139
This commit is contained in:
Allan Odgaard
2015-06-24 00:41:02 +02:00
parent 86dc42fdf4
commit 3fdc72b93a
3 changed files with 5 additions and 3 deletions

View File

@@ -23,7 +23,8 @@ void setup_fixtures ()
bundleIndex.commit();
NSApplicationLoad();
[NSSpellChecker sharedSpellChecker];
NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
spellChecker.automaticallyIdentifiesLanguages = NO;
}
void benchmark_insert_50_mb ()

View File

@@ -35,7 +35,7 @@ namespace ns
_OutputIter spellcheck (char const* first, char const* last, std::string const& language, long int tag, size_t offset, _OutputIter out)
{
NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
NSString* lang = [NSString stringWithCxxString:language];
NSString* lang = spellChecker.automaticallyIdentifiesLanguages ? nil : [NSString stringWithCxxString:language];
NSString* str = [NSString stringWithUTF8String:first length:last - first];
NSRange range = [spellChecker checkSpellingOfString:str startingAt:0 language:lang wrap:NO inSpellDocumentWithTag:tag wordCount:NULL];

View File

@@ -4,7 +4,8 @@
void setup ()
{
NSApplicationLoad();
[NSSpellChecker sharedSpellChecker];
NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
spellChecker.automaticallyIdentifiesLanguages = NO;
}
void test_spellcheck ()