mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-21 17:51:03 +00:00
Fix display of counters for included listings.
This commit is contained in:
parent
fe99f7b01e
commit
91bd457a67
@ -79,6 +79,7 @@ End
|
||||
|
||||
Counter listing
|
||||
GuiName Listing
|
||||
PrettyFormat "Listing ##"
|
||||
End
|
||||
|
||||
Counter equation
|
||||
|
@ -1444,22 +1444,28 @@ void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype, bool c
|
||||
if (!isListings(params()))
|
||||
return;
|
||||
|
||||
Buffer const & master = *buffer().masterBuffer();
|
||||
listings_label_ = master.B_("Program Listing");
|
||||
Counters & counters = master.params().documentClass().counters();
|
||||
docstring const cnt = from_ascii("listing");
|
||||
bool const hasCounter = counters.hasCounter(cnt);
|
||||
if (hasCounter) {
|
||||
counters.saveLastCounter();
|
||||
counters.step(cnt, utype);
|
||||
listings_label_ += " " + convert<docstring>(counters.value(cnt));
|
||||
}
|
||||
|
||||
if (label_)
|
||||
label_->updateBuffer(it, utype, deleted);
|
||||
|
||||
if (hasCounter)
|
||||
counters.restoreLastCounter();
|
||||
|
||||
InsetListingsParams const par(to_utf8(params()["lstparams"]));
|
||||
if (par.getParamValue("caption").empty()) {
|
||||
listings_label_ = buffer().B_("Program Listing");
|
||||
return;
|
||||
}
|
||||
Buffer const & master = *buffer().masterBuffer();
|
||||
Counters & counters = master.params().documentClass().counters();
|
||||
docstring const cnt = from_ascii("listing");
|
||||
listings_label_ = master.B_("Program Listing");
|
||||
if (counters.hasCounter(cnt)) {
|
||||
counters.step(cnt, utype);
|
||||
listings_label_ += " " + convert<docstring>(counters.value(cnt));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user