[LyX/master] Amend 4ba989000c4

Juergen Spitzmueller spitz at lyx.org
Sun Aug 7 07:56:36 UTC 2022


commit 75aaa8e22b2bec4d3c03712ca09ba13414ee6175
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Aug 7 10:41:02 2022 +0200

    Amend 4ba989000c4
    
    If the lfun argument already has a Flex: prefix (which is equivalent),
    do not append one
---
 src/Text3.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index f3d4d61..da23857 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -3182,7 +3182,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
 		break;
 	case LFUN_FLEX_INSERT: {
 		code = FLEX_CODE;
-		docstring s = from_ascii("Flex:") + from_utf8(cmd.getArg(0));
+		docstring s = from_utf8(cmd.getArg(0));
+		// Prepend "Flex:" prefix if not there
+		if (!prefixIs(s, from_ascii("Flex:")))
+			s = from_ascii("Flex:") + s;
 		if (!cur.buffer()->params().documentClass().hasInsetLayout(s))
 			enable = false;
 		else {


More information about the lyx-cvs mailing list