Skip to content

Commit 422ba57

Browse files
authored
Add message for enabling/disabling automatic spellcheck (#342)
1 parent 4f174f3 commit 422ba57

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/PluginMsg.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#define DSPELLCHECK_SETLANG_MSG 1 // See DSpellCheckSetLangMsgInfo
44
#define DSPELLCHECK_GETLANGUAGELIST_MSG 2 // See DSpellCheckGetLanguageListMsgInfo
5+
#define DSPELLCHECK_ENABLESPELLCHECK_MSG 3 // See DSpellCheckEnableSpellCheckMsgInfo
56

67
// Set language to lang_name, if was_success non-zero, it will be set to true in case of success and fales in case of failure
78
struct DSpellCheckSetLangMsgInfo {
@@ -14,3 +15,7 @@ struct DSpellCheckGetLanguageListMsgInfo {
1415
void (*language_callback)(void *payload, const wchar_t *lang_name);
1516
void *payload;
1617
};
18+
19+
struct DSpellCheckEnableSpellCheckMsgInfo {
20+
bool enabled;
21+
};

src/plugin/Plugin.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,13 @@ bool process_internal_msg(const CommunicationInfo& communication_info) {
907907
}
908908
}
909909
return true;
910+
case DSPELLCHECK_ENABLESPELLCHECK_MSG: {
911+
if (const auto info = reinterpret_cast<DSpellCheckEnableSpellCheckMsgInfo *>(communication_info.info)) {
912+
auto mut = settings->modify(SettingsModificationStyle::ignore_file_errors);
913+
mut->data.auto_check_text = info->enabled;
914+
}
915+
}
916+
return true;
910917
}
911918
return false;
912919
}

0 commit comments

Comments
 (0)