diff --git a/Frameworks/OakTextView/src/OakDocumentView.mm b/Frameworks/OakTextView/src/OakDocumentView.mm index 3ee9737e..9ca72c68 100644 --- a/Frameworks/OakTextView/src/OakDocumentView.mm +++ b/Frameworks/OakTextView/src/OakDocumentView.mm @@ -367,21 +367,6 @@ private: else [[NSUserDefaults standardUserDefaults] setObject:YES_obj forKey:@"DocumentView Disable Line Numbers"]; } -- (void)toggleContinuousSpellChecking:(id)sender -{ - bool flag = !document->buffer().live_spelling(); - document->buffer().set_live_spelling(flag); - settings_t::set(kSettingsSpellCheckingKey, flag, document->file_type(), document->path()); -} - -- (void)takeSpellingLanguageFrom:(id)sender -{ - NSString* lang = (NSString*)[sender representedObject]; - [[NSSpellChecker sharedSpellChecker] setLanguage:lang]; - document->buffer().set_spelling_language(to_s(lang)); - settings_t::set(kSettingsSpellingLanguageKey, to_s(lang), document->file_type(), document->path()); -} - - (BOOL)validateMenuItem:(NSMenuItem*)aMenuItem { if([aMenuItem action] == @selector(toggleLineNumbers:)) @@ -390,10 +375,6 @@ private: [aMenuItem setState:[textView theme]->uuid() == [[aMenuItem representedObject] UTF8String] ? NSOnState : NSOffState]; else if([aMenuItem action] == @selector(takeTabSizeFrom:)) [aMenuItem setState:textView.tabSize == [aMenuItem tag] ? NSOnState : NSOffState]; - else if([aMenuItem action] == @selector(toggleContinuousSpellChecking:)) - [aMenuItem setState:document->buffer().live_spelling() ? NSOnState : NSOffState]; - else if([aMenuItem action] == @selector(takeSpellingLanguageFrom:)) - [aMenuItem setState:[[NSString stringWithCxxString:document->buffer().spelling_language()] isEqualToString:[aMenuItem representedObject]] ? NSOnState : NSOffState]; return YES; } diff --git a/Frameworks/OakTextView/src/OakTextView.mm b/Frameworks/OakTextView/src/OakTextView.mm index 463518b1..92a63acd 100644 --- a/Frameworks/OakTextView/src/OakTextView.mm +++ b/Frameworks/OakTextView/src/OakTextView.mm @@ -1645,6 +1645,10 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac [aMenuItem setState:[self softWrap] ? NSOnState : NSOffState]; else if([aMenuItem action] == @selector(toggleShowWrapColumn:)) [aMenuItem setState:(layout && layout->draw_wrap_column()) ? NSOnState : NSOffState]; + else if([aMenuItem action] == @selector(toggleContinuousSpellChecking:)) + [aMenuItem setState:document->buffer().live_spelling() ? NSOnState : NSOffState]; + else if([aMenuItem action] == @selector(takeSpellingLanguageFrom:)) + [aMenuItem setState:[[NSString stringWithCxxString:document->buffer().spelling_language()] isEqualToString:[aMenuItem representedObject]] ? NSOnState : NSOffState]; else if([aMenuItem action] == @selector(takeWrapColumnFrom:)) { static NSInteger const Presets[] = { NSWrapColumnWindowWidth, 40, 80 }; @@ -1850,6 +1854,21 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac } } +- (void)toggleContinuousSpellChecking:(id)sender +{ + bool flag = !document->buffer().live_spelling(); + document->buffer().set_live_spelling(flag); + settings_t::set(kSettingsSpellCheckingKey, flag, document->file_type(), document->path()); +} + +- (void)takeSpellingLanguageFrom:(id)sender +{ + NSString* lang = (NSString*)[sender representedObject]; + [[NSSpellChecker sharedSpellChecker] setLanguage:lang]; + document->buffer().set_spelling_language(to_s(lang)); + settings_t::set(kSettingsSpellingLanguageKey, to_s(lang), document->file_type(), document->path()); +} + - (scope::context_t const&)scopeContext { static scope::context_t res;