From b41293352ea8d52890b7668f059fd07f09bd6bb6 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Wed, 16 Nov 2022 07:39:44 +0100 Subject: [PATCH] Fix broken Apple speller interface - restore spell checker result LEARNED_WORD - it's required for Apple speller engine - avoid use of "unlearn" of known dictionary word - it doesn't work with paragraph based spell check --- src/SpellChecker.h | 3 +++ src/frontends/qt/Menus.cpp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/SpellChecker.h b/src/SpellChecker.h index e3c65707b6..6b27c297cb 100644 --- a/src/SpellChecker.h +++ b/src/SpellChecker.h @@ -36,6 +36,8 @@ public: WORD_OK = 1, /// word not found UNKNOWN_WORD, + /// number of personal dictionary "word" + LEARNED_WORD, /// number of document dictionary "word" DOCUMENT_LEARNED_WORD, /// missing dictionary for language @@ -50,6 +52,7 @@ public: static bool misspelled(Result res) { return res != WORD_OK && res != NO_DICTIONARY + && res != LEARNED_WORD && res != DOCUMENT_LEARNED_WORD; } /// check the given word of the given lang code and return the result diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp index f4a2358f3c..c69ba5f0bc 100644 --- a/src/frontends/qt/Menus.cpp +++ b/src/frontends/qt/Menus.cpp @@ -883,7 +883,15 @@ void MenuDefinition::expandSpellingSuggestions(BufferView const * bv) case SpellChecker::WORD_OK: { if (wl.word().empty()) break; + SpellChecker * speller = theSpellChecker(); + if (speller && speller->canCheckParagraph()) + break; LYXERR(Debug::GUI, "Valid Word."); + } + // FALLTHROUGH + case SpellChecker::LEARNED_WORD: { + if (res == SpellChecker::LEARNED_WORD) + LYXERR(Debug::GUI, "Learned Word."); docstring const arg = wl.word() + " " + from_ascii(wl.lang()->lang()); add(MenuItem(MenuItem::Command, qt_("Remove from personal dictionary|r"), FuncRequest(LFUN_SPELLING_REMOVE, arg))); -- 2.39.5