commit 5e94eee9c64d2629ca7c1c8d3095c448b76b4145
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Jul 26 12:29:13 2026 +0200
Ignore case with minted languages
---
src/frontends/qt/GuiListings.cpp | 2 +-
src/insets/InsetListingsParams.cpp | 21 ++++++++++++++++-----
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/frontends/qt/GuiListings.cpp b/src/frontends/qt/GuiListings.cpp
index de90abef82..79cc2acf6d 100644
--- a/src/frontends/qt/GuiListings.cpp
+++ b/src/frontends/qt/GuiListings.cpp
@@ -449,7 +449,7 @@ void GuiListings::updateContents()
} else {
language = arg;
}
- int n = languageCO->findData(toqstr(language));
+ int n = languageCO->findData(toqstr(language),
Qt::UserRole, Qt::MatchFixedString);
if (n >= 0) {
languageCO->setCurrentIndex(n);
in_gui = true;
diff --git a/src/insets/InsetListingsParams.cpp
b/src/insets/InsetListingsParams.cpp
index 6b007e6b59..c152ee2131 100644
--- a/src/insets/InsetListingsParams.cpp
+++ b/src/insets/InsetListingsParams.cpp
@@ -38,6 +38,7 @@ enum param_type {
LENGTH, // accept a latex length
SKIP, // accept a skip or a length
ONEOF, // accept one of a few values
+ ONEOF_CI, // accept one of a few values, case-insensitively
SUBSETOF // accept a string composed of given characters
};
@@ -182,7 +183,9 @@ docstring ListingsParam::validate(string const & par) const
return _("Unbalanced braces!");
return docstring();
+ case ONEOF_CI:
case ONEOF: {
+ bool const case_ins = type_ == ONEOF_CI;
if (par2.empty() && !onoff_) {
if (!hint_.empty())
return hint_;
@@ -195,16 +198,24 @@ docstring ListingsParam::validate(string const & par)
const
string v;
for (size_t i = 0; i != info_.size(); ++i) {
if (info_[i] == '\n') {
- lists.push_back(v);
+ if (case_ins)
+ lists.push_back(lowercase(v));
+ else
+ lists.push_back(v);
v = string();
} else
v += info_[i];
}
- if (!v.empty())
- lists.push_back(v);
+ if (!v.empty()) {
+ if (case_ins)
+ lists.push_back(lowercase(v));
+ else
+ lists.push_back(v);
+ }
// good, find the string
- if (find(lists.begin(), lists.end(), par2) != lists.end()) {
+ string match = case_ins ? lowercase(par2) : par2;
+ if (find(lists.begin(), lists.end(), match) != lists.end()) {
if (unclosed)
return _("Unbalanced braces!");
return docstring();
@@ -764,7 +775,7 @@ ParValidator::ParValidator()
ListingsParam("", false, ONEOF,
"none\ntopline\nbottomline\nall", empty_hint);
all_params_[1]["language"] =
- ListingsParam("", false, ONEOF,
listinglanguages.getAllowedLangValues(true), empty_hint);
+ ListingsParam("", false, ONEOF_CI,
listinglanguages.getAllowedLangValues(true), empty_hint);
all_params_[1]["lastline"] =
ListingsParam("", false, INTEGER, "", empty_hint);
all_params_[1]["linenos"] =
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs