[LyX master] Fix display of counters for included listings.
Jürgen Spitzmüller
juergen.spitzmueller at univie.ac.at
Sat Feb 10 08:45:40 UTC 2024
Am Samstag, dem 10.02.2024 um 00:55 +0000 schrieb Richard Kimberly
Heck:
> The branch, master, has been updated.
You are aware that this broke the string freeze, right? So translators
should be informed to update once more before the final release.
Jürgen
>
> - Log ---------------------------------------------------------------
> --
>
> commit 91bd457a674579e1bc9e61aab19c272cd0d342dd
> Author: Richard Kimberly Heck <rikiheck at lyx.org>
> Date: Fri Feb 9 19:53:55 2024 -0500
>
> Fix display of counters for included listings.
>
> diff --git a/lib/layouts/stdcounters.inc
> b/lib/layouts/stdcounters.inc
> index dbebe25b03..ee143f6b0f 100644
> --- a/lib/layouts/stdcounters.inc
> +++ b/lib/layouts/stdcounters.inc
> @@ -79,6 +79,7 @@ End
>
> Counter listing
> GuiName Listing
> + PrettyFormat "Listing ##"
> End
>
> Counter equation
> diff --git a/src/insets/InsetInclude.cpp
> b/src/insets/InsetInclude.cpp
> index 916196211a..92ec17169c 100644
> --- a/src/insets/InsetInclude.cpp
> +++ b/src/insets/InsetInclude.cpp
> @@ -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));
> - }
> }
>
>
>
> ---------------------------------------------------------------------
> --
>
> Summary of changes:
> lib/layouts/stdcounters.inc | 1 +
> src/insets/InsetInclude.cpp | 22 ++++++++++++++--------
> 2 files changed, 15 insertions(+), 8 deletions(-)
>
>
> hooks/post-receive
> --
> The LyX Source Repository
--
Univ.-Prof. Dr. Jürgen Spitzmüller
Universitätsprofessur für Angewandte Sprachwissenschaft
Universität Wien
Institut für Sprachwissenschaft
Sensengasse 3a
A-1090 Wien
Tel +43 (0)1 4277 417 24
Fax +43 (0)1 4277 9 417
http://linguistics.univie.ac.at
http://www.spitzmueller.org
VCard: http://www.spitzmueller.org/docs/jsp.vcf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240210/98cc29e6/attachment.asc>
More information about the lyx-devel
mailing list