mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Disallow the insertion of multiplenon-item arguments of the same type in a sequence of merged environment pars
This commit is contained in:
parent
aad1f4ce78
commit
99ee47f0cd
@ -2533,16 +2533,38 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
args.find(arg);
|
args.find(arg);
|
||||||
if (lait != args.end()) {
|
if (lait != args.end()) {
|
||||||
enable = true;
|
enable = true;
|
||||||
InsetList::const_iterator it = cur.paragraph().insetList().begin();
|
pit_type pit = cur.pit();
|
||||||
InsetList::const_iterator const end = cur.paragraph().insetList().end();
|
pit_type lastpit = cur.pit();
|
||||||
for (; it != end; ++it) {
|
if (lay.isEnvironment() && !prefixIs(arg, "item:")) {
|
||||||
if (it->inset->lyxCode() == ARG_CODE) {
|
// In a sequence of "merged" environment layouts, we only allow
|
||||||
InsetArgument const * ins =
|
// non-item arguments once.
|
||||||
static_cast<InsetArgument const *>(it->inset);
|
lastpit = cur.lastpit();
|
||||||
if (ins->name() == arg) {
|
// get the first paragraph in sequence with this layout
|
||||||
// we have this already
|
depth_type const current_depth = cur.paragraph().params().depth();
|
||||||
enable = false;
|
while (true) {
|
||||||
|
if (pit == 0)
|
||||||
break;
|
break;
|
||||||
|
Paragraph cpar = pars_[pit - 1];
|
||||||
|
if (cpar.layout() == lay && cpar.params().depth() == current_depth)
|
||||||
|
--pit;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (; pit <= lastpit; ++pit) {
|
||||||
|
if (pars_[pit].layout() != lay)
|
||||||
|
break;
|
||||||
|
InsetList::const_iterator it = pars_[pit].insetList().begin();
|
||||||
|
InsetList::const_iterator end = pars_[pit].insetList().end();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
if (it->inset->lyxCode() == ARG_CODE) {
|
||||||
|
InsetArgument const * ins =
|
||||||
|
static_cast<InsetArgument const *>(it->inset);
|
||||||
|
if (ins->name() == arg) {
|
||||||
|
// we have this already
|
||||||
|
enable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user