commit cd8338636395daaa2b9f7a27c3efdcfddc17f993
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Tue Jul 19 12:31:50 2022 +0200
Disable flex-insert when inset does not exist
This is useful when adding icons to the toolbar that insert insets not
availble by default (but provided by a module).
Fixes bug #11690.
---
src/Text3.cpp | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 5bfde06..7422bea 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -3183,13 +3183,17 @@ bool Text::getStatus(Cursor & cur, FuncRequest const &
cmd,
case LFUN_FLEX_INSERT: {
code = FLEX_CODE;
string s = cmd.getArg(0);
- InsetLayout il =
-
cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
- if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
- il.lyxtype() != InsetLyXType::CUSTOM &&
- il.lyxtype ()!= InsetLyXType::STANDARD)
+ if
(!cur.buffer()->params().documentClass().hasInsetLayout(from_utf8(s)))
enable = false;
- break;
+ else {
+ InsetLayout il =
+
cur.buffer()->params().documentClass().insetLayout(from_utf8(s));
+ if (il.lyxtype() != InsetLyXType::CHARSTYLE &&
+ il.lyxtype() != InsetLyXType::CUSTOM &&
+ il.lyxtype ()!= InsetLyXType::STANDARD)
+ enable = false;
+ }
+ break;
}
case LFUN_BOX_INSERT:
code = BOX_CODE;
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs