Add LFUN_FONT_NO_SPELLCHECK

This commit is contained in:
Juergen Spitzmueller 2021-03-05 18:23:38 +01:00
parent 11d6708781
commit f1f475e1d3
5 changed files with 23 additions and 0 deletions

View File

@ -100,6 +100,9 @@
* export-cancel: Used to cancel background export processes.
* font-nospellcheck marks the word under cursor or selection to the effect that the
spellchecker ignores it.
* ifrelatives is a helper function to check whether a buffer has a master or children.
* lyxfiles-open opens the new examples or templates dialog.

View File

@ -496,6 +496,7 @@ enum FuncCode
LFUN_INSET_SPLIT, // jspitzm 20201222
LFUN_LYXFILES_OPEN, // jspitzm 20210210
LFUN_SEARCH_STRING_SET, // stwitt/jspitzm 20210212
LFUN_FONT_NO_SPELLCHECK, // jspitzm 20210305
LFUN_LASTACTION // end of the table
};

View File

@ -1834,6 +1834,15 @@ void LyXAction::init()
*/
{ LFUN_FONT_CROSSOUT, "font-crossout", Noop, Layout },
/*!
* \var lyx::FuncCode lyx::LFUN_FONT_NO_SPELLCHECK
* \li Action: Toggles nospellcheck status in the font (selection-wise).
* \li Syntax: font-nospellcheck
* \li Origin: spitz, 5 March 2021
* \endvar
*/
{ LFUN_FONT_NO_SPELLCHECK, "font-nospellcheck", Noop, Layout },
/*!
* \var lyx::FuncCode lyx::LFUN_FONT_TYPEWRITER
* \li Action: Toggles the typewriter family font (selection-wise).

View File

@ -2474,6 +2474,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
break;
}
case LFUN_FONT_NO_SPELLCHECK: {
Font font(ignore_font, ignore_language);
font.fontInfo().setNoSpellcheck(FONT_TOGGLE);
toggleAndShow(cur, this, font);
break;
}
case LFUN_FONT_SIZE: {
Font font(ignore_font, ignore_language);
setLyXSize(to_utf8(cmd.argument()), font.fontInfo());
@ -3550,6 +3557,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_FONT_CROSSOUT:
case LFUN_FONT_UNDERUNDERLINE:
case LFUN_FONT_UNDERWAVE:
case LFUN_FONT_NO_SPELLCHECK:
case LFUN_TEXTSTYLE_UPDATE:
enable = !cur.paragraph().isPassThru();
break;

View File

@ -862,6 +862,8 @@ void MenuDefinition::expandSpellingSuggestions(BufferView const * bv)
docstring const arg = wl.word() + " " + from_ascii(wl.lang()->lang());
add(MenuItem(MenuItem::Command, qt_("Add to personal dictionary|n"),
FuncRequest(LFUN_SPELLING_ADD, arg)));
add(MenuItem(MenuItem::Command, qt_("Ignore|g"),
FuncRequest(LFUN_FONT_NO_SPELLCHECK, arg)));
add(MenuItem(MenuItem::Command, qt_("Ignore all|I"),
FuncRequest(LFUN_SPELLING_IGNORE, arg)));
}