mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug 5787-part_2 (Labels in Listings Children Don't Update Properly).
It was still possible to set the label of an included Program Listing to an already existing label (if there was no label specified yet). See also: http://www.lyx.org/trac/changeset/28556 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28564 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bc5bc24812
commit
90feb482db
@ -241,24 +241,28 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
InsetListingsParams new_params(to_utf8(p["lstparams"]));
|
||||
docstring const new_label =
|
||||
from_utf8(new_params.getParamValue("label"));
|
||||
docstring old_label;
|
||||
if (label_)
|
||||
old_label = label_->getParam("name");
|
||||
|
||||
if (new_label.empty()) {
|
||||
delete label_;
|
||||
label_ = 0;
|
||||
} else if (label_ && old_label != new_label) {
|
||||
label_->updateCommand(new_label);
|
||||
// the label might have been adapted (duplicate)
|
||||
if (new_label != label_->getParam("name")) {
|
||||
new_params.addParam("label",
|
||||
"{" + to_utf8(label_->getParam("name")) + "}");
|
||||
p["lstparams"] = from_utf8(new_params.params());
|
||||
} else {
|
||||
docstring old_label;
|
||||
if (label_)
|
||||
old_label = label_->getParam("name");
|
||||
else {
|
||||
label_ = createLabel(new_label);
|
||||
label_->setBuffer(buffer());
|
||||
}
|
||||
|
||||
if (new_label != old_label) {
|
||||
label_->updateCommand(new_label);
|
||||
// the label might have been adapted (duplicate)
|
||||
if (new_label != label_->getParam("name")) {
|
||||
new_params.addParam("label", "{" +
|
||||
to_utf8(label_->getParam("name")) + "}", true);
|
||||
p["lstparams"] = from_utf8(new_params.params());
|
||||
}
|
||||
}
|
||||
} else if (old_label != new_label) {
|
||||
label_ = createLabel(new_label);
|
||||
label_->setBuffer(buffer());
|
||||
label_->initView();
|
||||
}
|
||||
}
|
||||
setParams(p);
|
||||
|
Loading…
Reference in New Issue
Block a user