[LyX/master] Add LFUN_FONT_NO_SPELLCHECK

Juergen Spitzmueller spitz at lyx.org
Fri Mar 5 17:19:32 UTC 2021


commit f1f475e1d32525a1a6b31e75367ee4697f621f77
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Mar 5 18:23:38 2021 +0100

    Add LFUN_FONT_NO_SPELLCHECK
---
 lib/RELEASE-NOTES          |    3 +++
 src/FuncCode.h             |    1 +
 src/LyXAction.cpp          |    9 +++++++++
 src/Text3.cpp              |    8 ++++++++
 src/frontends/qt/Menus.cpp |    2 ++
 5 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 32d44aa..3496575 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -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.
diff --git a/src/FuncCode.h b/src/FuncCode.h
index f473cda..9976a1d 100644
--- a/src/FuncCode.h
+++ b/src/FuncCode.h
@@ -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
 };
 
diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 0d43ea5..efabfff 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -1835,6 +1835,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).
  * \li Syntax: font-typewriter
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 9c7b10f..a66a1b7 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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;
diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp
index 8139ff9..8f5ae7c 100644
--- a/src/frontends/qt/Menus.cpp
+++ b/src/frontends/qt/Menus.cpp
@@ -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)));
 			}


More information about the lyx-cvs mailing list