commit 5a53d3b4a0bb79cdddf567939609ac2190eedfec
Author: Juergen Spitzmueller <[email protected]>
Date: Fri Oct 10 13:42:45 2025 +0200
Disable features which are not yet supported by InsetMathRef
---
src/frontends/qt/GuiRef.cpp | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/frontends/qt/GuiRef.cpp b/src/frontends/qt/GuiRef.cpp
index 63b7332ce0..dceec9bbf3 100644
--- a/src/frontends/qt/GuiRef.cpp
+++ b/src/frontends/qt/GuiRef.cpp
@@ -250,13 +250,24 @@ void GuiRef::updateAddPB()
typeCO->itemData(typeCO->currentIndex()).toString();
bool const threshold = (reftype == "vref" || reftype == "vpageref")
&& selectedLV->topLevelItemCount() > 1;
+ // these are not yet supported by InsetMathRef
+ bool const notsupported = bufferview()->cursor().inMathed()
+ && selectedLV->topLevelItemCount() > 0
+ && reftype != "labelonly"
+ && ((reftype == "vref" || reftype == "vpageref") &&
buffer().params().xref_package != "cleveref")
+ || reftype == "ref" || reftype == "pageref" ||
reftype == "eqref" || reftype == "nameref"
+ || (reftype == "cpageref" &&
buffer().params().xref_package == "cleveref"
+ && buffer().params().xref_package == "zref")
+ || (reftype == "formatted" &&
prefixIs(buffer().params().xref_package, "prettyref"));
+
int const arows = refsTW->model()->rowCount();
QModelIndexList const availSels =
refsTW->selectionModel()->selectedIndexes();
addPB->setEnabled(arows > 0
&& !availSels.isEmpty()
&& !isSelected(availSels.first())
- && !threshold);
+ && !threshold
+ && !notsupported);
}
@@ -999,7 +1010,16 @@ bool GuiRef::isValid()
typeCO->itemData(typeCO->currentIndex()).toString();
bool const threshold = (reftype == "vref" || reftype == "vpageref")
&& selectedLV->topLevelItemCount() > 1;
- return selectedLV->currentItem() && !threshold;
+ // these are not yet supported by InsetMathRef
+ bool const notsupported = bufferview()->cursor().inMathed()
+ && selectedLV->topLevelItemCount() > 0
+ && reftype != "labelonly"
+ && ((reftype == "vref" || reftype == "vpageref") &&
buffer().params().xref_package != "cleveref")
+ || reftype == "ref" || reftype == "pageref" ||
reftype == "eqref" || reftype == "nameref"
+ || (reftype == "cpageref" &&
buffer().params().xref_package == "cleveref"
+ && buffer().params().xref_package == "zref")
+ || (reftype == "formatted" &&
prefixIs(buffer().params().xref_package, "prettyref"));
+ return selectedLV->currentItem() && !threshold && !notsupported;
}
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs