mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Synchronize spelling panel and buffer languages
If the spelling panel is visible when checkSpelling: is invoked then its language is taken and used for the buffer. If the panel is not visible, the buffer’s language is set for the spelling panel. We probably should also set the spelling panel’s language when switching document, and when the panel is first opened. I don’t think the code complexity is really worth it though (depends on how often one use the spelling panel with a non-default language). Fixes #1104
This commit is contained in:
@@ -2431,6 +2431,20 @@ static char const* kOakMenuItemTitle = "OakMenuItemTitle";
|
||||
NSSpellChecker* speller = [NSSpellChecker sharedSpellChecker];
|
||||
ng::buffer_t& buf = document->buffer();
|
||||
|
||||
NSString* lang = [NSString stringWithCxxString:buf.spelling_language()];
|
||||
if([[speller spellingPanel] isVisible])
|
||||
{
|
||||
if(![[speller language] isEqualToString:lang])
|
||||
{
|
||||
buf.set_spelling_language(to_s([speller language]));
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[speller setLanguage:lang];
|
||||
}
|
||||
|
||||
if(!buf.live_spelling())
|
||||
{
|
||||
buf.set_live_spelling(true);
|
||||
|
||||
Reference in New Issue
Block a user