Skip to content

Commit

Permalink
Add message for enabling/disabling automatic spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Predelnik committed Apr 10, 2024
1 parent 4f174f3 commit 7f5e40f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/PluginMsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#define DSPELLCHECK_SETLANG_MSG 1 // See DSpellCheckSetLangMsgInfo
#define DSPELLCHECK_GETLANGUAGELIST_MSG 2 // See DSpellCheckGetLanguageListMsgInfo
#define DSPELLCHECK_ENABLESPELLCHECK_MSG 3 // See DSpellCheckEnableSpellCheckMsgInfo

// 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
struct DSpellCheckSetLangMsgInfo {
Expand All @@ -14,3 +15,7 @@ struct DSpellCheckGetLanguageListMsgInfo {
void (*language_callback)(void *payload, const wchar_t *lang_name);
void *payload;
};

struct DSpellCheckEnableSpellCheckMsgInfo {
bool enabled;
};
7 changes: 7 additions & 0 deletions src/plugin/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,13 @@ bool process_internal_msg(const CommunicationInfo& communication_info) {
}
}
return true;
case DSPELLCHECK_ENABLESPELLCHECK_MSG: {
if (const auto info = reinterpret_cast<DSpellCheckEnableSpellCheckMsgInfo *>(communication_info.info)) {
auto mut = settings->modify(SettingsModificationStyle::ignore_file_errors);
mut->data.auto_check_text = info->enabled;
}
}
return true;
}
return false;
}
Expand Down

0 comments on commit 7f5e40f

Please sign in to comment.