[PATCH] Allow removing words from the personal dictionary, that weren't previously added

Stephan Witt st.witt at gmx.net
Sun Nov 20 11:34:01 UTC 2022


Am 20.11.2022 um 12:01 schrieb Jürgen Spitzmüller <jspitzm at gmail.com>:
> 
> Am Mittwoch, dem 16.11.2022 um 07:55 +0100 schrieb Stephan Witt:
>> I’ve made two patches on top of Isaacs patch to make it work again on
>> Mac. 
>> See attached patches. 1st one is the patch from Isaac, 2nd and 3rd
>> are mine.
> 
> Thanks!
> 
>> 1. There are code paths with SpellChecker::WORD_OK with WordLangTuple
>> not being assigned anywhere. 
>> IMO a check for it is required to avoid a crash when using the lang
>> pointer later.
> 
> Shouldn't you rather (or additionally) check for !wl.lang()? Or is it
> clear that !wl.word.empty() means we have a lang() pointer?

Yes, actually it is clear. But an additionally check for !wl.lang() is more save.

>> 2. Spell checkers in paragraph check mode (Apple) aren’t using the
>> exclude word list at all.
>> IMO it's the right thing to skip the option to add words to the
>> exclude word list then.
> 
> But don't you disable the removal from Apple's personal dictionary
> (AppleSpellChecker::remove) with this as well? Didn't this work before
> the patch?

Yes, it never worked before.

If unlearnWord is called it has an effect for learned words only.

There is no call interface to unlearn a word in main dictionary.

>> Please test and give feedback for it…
>> 
>> I’ve noticed two additional problems while testing:
>> 
>> 1. The new feature with exclude word lists doesn’t work for me with
>> Hunspell. 
>> But this may be a defect of my private hunspell framework.
> 
> It works for me with Hunspell (note that the lists are only saved upon
> LyX closure).
> 
> What I find odd, though, is the naming in the menu. When I click on a
> word that is in the main dictionary, e.g. "table", it offers me to
> "Remove from personal dictionary". But this is wrong. It doesn't remove
> it from any dictionary, but adds it on personal exclusion list. So the
> menu entry here should read "Treat this word as incorrect".
> 
> Likewise, if I "un-ignore" such a word, the menu offers me to "Add to
> personal dictionary". This is wrong as well. Should read
> "Don't treat this word as incorrect“.

Yes, this probably is an effect of the handling of the spell checker result in LyXs hunspell interface implementation.

The solution would be to add and use more SpellChecker::Result values in HunspellChecker::check() to get the option to differentiate here.

>> 2. There is no context menu option to revert the
>> LFUN_FONT_NO_SPELLCHECK. 
>> One may use the font options dialog - but opening it resets the
>> NO_SPELLCHECK from word immediately.
> 
> There is: "Ignore This Occurrence". It shows when opening the context
> menu upon a misspelled word. This triggers the LFUN.

Yes, but the „Unignore“ option is not in drop-down menu.

The font options dialog resets NO_SPELLCHECK on open.

Stephan


More information about the lyx-devel mailing list