commit 049a87e91b71991426a6cc3562f8aa17d1a952e5
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Mon Apr 7 09:45:57 2025 +0200

    Disallow the use of '@' in labels
    
    These are now used as separators in the external filenames list
---
 src/Text.cpp                  | 2 ++
 src/frontends/qt/GuiLabel.cpp | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 4e1cc2986b..56c76261e9 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -2277,6 +2277,8 @@ docstring Text::getPossibleLabel(DocIterator const & cur) 
const
        // commas are not allowed, as they are used to separate multiple
        // in cross-references
        par_text = subst(par_text, ',', '-');
+       // same for @ as they are used as separators in the filename list
+       par_text = subst(par_text, '@', '-');
        int const numwords = 3;
        for (int i = 0; i < numwords; ++i) {
                if (par_text.empty())
diff --git a/src/frontends/qt/GuiLabel.cpp b/src/frontends/qt/GuiLabel.cpp
index 9cbff568f1..c04ab25ef9 100644
--- a/src/frontends/qt/GuiLabel.cpp
+++ b/src/frontends/qt/GuiLabel.cpp
@@ -39,7 +39,8 @@ GuiLabel::GuiLabel(QWidget * parent) : 
InsetParamsWidget(parent)
        connect(keywordED, SIGNAL(textChanged(const QString &)),
                this, SIGNAL(changed()));
 
-       QRegularExpression nocomma_re("[^,]+");
+       // disallow the input of , and @ as they are used as separators
+       QRegularExpression nocomma_re("[^,@]+");
        keywordED->setValidator(new QRegularExpressionValidator(nocomma_re, 
keywordED));
 
        setFocusProxy(keywordED);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to